summaryrefslogtreecommitdiff
path: root/internal/handlers/handler_authz_impl_forwardauth.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/handler_authz_impl_forwardauth.go')
-rw-r--r--internal/handlers/handler_authz_impl_forwardauth.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/handlers/handler_authz_impl_forwardauth.go b/internal/handlers/handler_authz_impl_forwardauth.go
index a042c13bb..d385cf971 100644
--- a/internal/handlers/handler_authz_impl_forwardauth.go
+++ b/internal/handlers/handler_authz_impl_forwardauth.go
@@ -50,6 +50,12 @@ func handleAuthzUnauthorizedForwardAuth(ctx *middlewares.AutheliaCtx, authn *Aut
}
}
- ctx.Logger.Infof("Access to %s (method %s) is not authorized to user %s, responding with status code %d with location redirect to %s", authn.Object.String(), authn.Method, authn.Username, statusCode, redirectionURL)
- ctx.SpecialRedirect(redirectionURL.String(), statusCode)
+ ctx.Logger.Infof(logFmtAuthzRedirect, authn.Object.String(), authn.Method, authn.Username, statusCode, redirectionURL)
+
+ switch authn.Object.Method {
+ case fasthttp.MethodHead:
+ ctx.SpecialRedirectNoBody(redirectionURL.String(), statusCode)
+ default:
+ ctx.SpecialRedirect(redirectionURL.String(), statusCode)
+ }
}