add more debug when unauthorized

This commit is contained in:
alteredCoder 2023-11-22 16:25:20 +01:00
parent dd6e539717
commit b6899e0c10

View file

@ -331,6 +331,9 @@ func (w *WaapSource) waapHandler(rw http.ResponseWriter, r *http.Request) {
if !exists || time.Now().After(expiration) {
if !w.IsAuth(apiKey) {
rw.WriteHeader(http.StatusUnauthorized)
clientIP := r.Header.Get(waf.IPHeaderName)
remoteIP := r.RemoteAddr
w.logger.Errorf("Unauthorized request from '%s' (real IP = %s)", remoteIP, clientIP)
return
}