feat: log X-Real-IP

This commit is contained in:
HeshamTB 2023-09-20 00:31:13 +03:00
parent 056a4a963c
commit ec94bce2aa

View File

@ -12,8 +12,9 @@ type AuthHandler struct {
func (l *AuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (l *AuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
AuthHeader := r.Header.Get("Authorization") AuthHeader := r.Header.Get("Authorization")
RealIP := r.Header.Get("X-Real-IP")
if AuthHeader != task.Auth { if AuthHeader != task.Auth {
log.Printf("Dropping request from %s.", r.RemoteAddr) log.Printf("Dropping request from %s.", RealIP)
return // drop return // drop
} }
l.Handler.ServeHTTP(w, r) l.Handler.ServeHTTP(w, r)