You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way this should probably work is that you return caddyhttp.Error(http.StatusUnauthorized, fmt.Errorf("not authenticated")) instead, similarly to the caddyauth module:
An issue I noticed while reviewing the code is that on error, this handler just returns
nil
caddy-extauth/extauth.go
Lines 81 to 86 in 2cb3268
This means that users don't get an opportunity to handle the error case with the
handle_errors
directive: https://caddyserver.com/docs/caddyfile/directives/handle_errorsThe way this should probably work is that you return
caddyhttp.Error(http.StatusUnauthorized, fmt.Errorf("not authenticated"))
instead, similarly to thecaddyauth
module:https://github.com/caddyserver/caddy/blob/653a0d3f6bd7b66197abd1e00e366164876a9f2b/modules/caddyhttp/caddyauth/caddyauth.go#L88
Using
caddyhttp.Error
gives Caddy an opportunity to handle the error and do something else with it:https://github.com/caddyserver/caddy/blob/653a0d3f6bd7b66197abd1e00e366164876a9f2b/modules/caddyhttp/server.go#L238
The text was updated successfully, but these errors were encountered: