mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-19 14:56:52 +00:00
feat(handler/reverseproxy): filter relevant access requests
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user