From c6355ee402ac906aca383f21b8794911a1122d64 Mon Sep 17 00:00:00 2001 From: Nick Nikolakakis Date: Sat, 14 Mar 2026 05:09:25 +0200 Subject: [PATCH] docs: add statusRewrites to Traefik Errors middleware example (#3360) Add statusRewrites (401 -> 302) to the ForwardAuth with Errors middleware configuration and a troubleshooting note explaining that without it, browsers may show a "Found." link instead of auto-redirecting to the identity provider. Fixes #3359 Signed-off-by: Nick Nikolakakis Signed-off-by: Jan Larwig Co-authored-by: Jan Larwig --- docs/docs/configuration/integrations/traefik.md | 8 ++++++++ .../version-7.10.x/configuration/integration.md | 8 ++++++++ .../version-7.11.x/configuration/integration.md | 8 ++++++++ .../version-7.12.x/configuration/integration.md | 8 ++++++++ .../version-7.13.x/configuration/integrations/traefik.md | 8 ++++++++ .../version-7.14.x/configuration/integrations/traefik.md | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/docs/docs/configuration/integrations/traefik.md b/docs/docs/configuration/integrations/traefik.md index e4b64b94..43830d43 100644 --- a/docs/docs/configuration/integrations/traefik.md +++ b/docs/docs/configuration/integrations/traefik.md @@ -79,8 +79,16 @@ http: - "401-403" service: oauth-backend query: "/oauth2/sign_in?rd={url}" + statusRewrites: + "401": 302 ``` +:::caution Troubleshooting: Browser shows "Found." instead of redirecting +When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider. + +Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically. +::: + ### ForwardAuth with static upstreams configuration Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint diff --git a/docs/versioned_docs/version-7.10.x/configuration/integration.md b/docs/versioned_docs/version-7.10.x/configuration/integration.md index a5afeda4..181cdbf9 100644 --- a/docs/versioned_docs/version-7.10.x/configuration/integration.md +++ b/docs/versioned_docs/version-7.10.x/configuration/integration.md @@ -225,8 +225,16 @@ http: - "401-403" service: oauth-backend query: "/oauth2/sign_in?rd={url}" + statusRewrites: + "401": 302 ``` +:::info Troubleshooting: Browser shows "Found." instead of redirecting +When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider. + +Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically. +::: + ### ForwardAuth with static upstreams configuration Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint diff --git a/docs/versioned_docs/version-7.11.x/configuration/integration.md b/docs/versioned_docs/version-7.11.x/configuration/integration.md index a5afeda4..181cdbf9 100644 --- a/docs/versioned_docs/version-7.11.x/configuration/integration.md +++ b/docs/versioned_docs/version-7.11.x/configuration/integration.md @@ -225,8 +225,16 @@ http: - "401-403" service: oauth-backend query: "/oauth2/sign_in?rd={url}" + statusRewrites: + "401": 302 ``` +:::info Troubleshooting: Browser shows "Found." instead of redirecting +When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider. + +Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically. +::: + ### ForwardAuth with static upstreams configuration Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint diff --git a/docs/versioned_docs/version-7.12.x/configuration/integration.md b/docs/versioned_docs/version-7.12.x/configuration/integration.md index a5afeda4..181cdbf9 100644 --- a/docs/versioned_docs/version-7.12.x/configuration/integration.md +++ b/docs/versioned_docs/version-7.12.x/configuration/integration.md @@ -225,8 +225,16 @@ http: - "401-403" service: oauth-backend query: "/oauth2/sign_in?rd={url}" + statusRewrites: + "401": 302 ``` +:::info Troubleshooting: Browser shows "Found." instead of redirecting +When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider. + +Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically. +::: + ### ForwardAuth with static upstreams configuration Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint diff --git a/docs/versioned_docs/version-7.13.x/configuration/integrations/traefik.md b/docs/versioned_docs/version-7.13.x/configuration/integrations/traefik.md index e4b64b94..f6ea35f8 100644 --- a/docs/versioned_docs/version-7.13.x/configuration/integrations/traefik.md +++ b/docs/versioned_docs/version-7.13.x/configuration/integrations/traefik.md @@ -79,8 +79,16 @@ http: - "401-403" service: oauth-backend query: "/oauth2/sign_in?rd={url}" + statusRewrites: + "401": 302 ``` +:::info Troubleshooting: Browser shows "Found." instead of redirecting +When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider. + +Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically. +::: + ### ForwardAuth with static upstreams configuration Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint diff --git a/docs/versioned_docs/version-7.14.x/configuration/integrations/traefik.md b/docs/versioned_docs/version-7.14.x/configuration/integrations/traefik.md index e4b64b94..f6ea35f8 100644 --- a/docs/versioned_docs/version-7.14.x/configuration/integrations/traefik.md +++ b/docs/versioned_docs/version-7.14.x/configuration/integrations/traefik.md @@ -79,8 +79,16 @@ http: - "401-403" service: oauth-backend query: "/oauth2/sign_in?rd={url}" + statusRewrites: + "401": 302 ``` +:::info Troubleshooting: Browser shows "Found." instead of redirecting +When using the Errors middleware without `statusRewrites`, the redirect response from oauth2-proxy can be served within the original 401/403 status context. This causes some browsers to display a "Found." link instead of automatically following the redirect to the identity provider. + +Adding `statusRewrites` to rewrite `401 -> 302` ensures the browser treats the response as a proper redirect and follows it automatically. +::: + ### ForwardAuth with static upstreams configuration Redirect to sign_in functionality provided without the use of `errors` middleware with [Traefik v2 `ForwardAuth` middleware](https://doc.traefik.io/traefik/middlewares/http/forwardauth/) pointing to oauth2-proxy service's `/` endpoint