diff --git a/pkg/handler/reverseproxy.go b/pkg/handler/reverseproxy.go index 06cb006..bac13a2 100644 --- a/pkg/handler/reverseproxy.go +++ b/pkg/handler/reverseproxy.go @@ -155,7 +155,7 @@ func (rp *ReverseProxy) Handler(src ReverseProxySource, w http.ResponseWriter, r if isAuthenticated { ctx = mw.WithAccessToken(ctx, accessToken) - if rp.EnableAccessLogs { + if rp.EnableAccessLogs && isRelevantAccessLog(r) { logger.Info("default: authenticated request") } } @@ -217,6 +217,16 @@ func handleAutologin(src ReverseProxySource, w http.ResponseWriter, r *http.Requ } } +func isRelevantAccessLog(r *http.Request) bool { + if r.Method == http.MethodGet { + // only log GET requests that are navigation requests + return isNavigationRequest(r) + } + + // all other methods are relevant + return true +} + func isNavigationRequest(r *http.Request) bool { // we assume that navigation requests are always GET requests if r.Method != http.MethodGet {