From fa44d6682562c87f568712868bdbeccc8213093c Mon Sep 17 00:00:00 2001 From: "dosubot[bot]" <131922026+dosubot[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:25:12 +0000 Subject: [PATCH] docs: add headers reference and proxy configuration guide --- src/content/docs/docs/reference/headers.mdx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/content/docs/docs/reference/headers.mdx b/src/content/docs/docs/reference/headers.mdx index 195a16b..3b8ed76 100644 --- a/src/content/docs/docs/reference/headers.mdx +++ b/src/content/docs/docs/reference/headers.mdx @@ -100,3 +100,20 @@ Additional headers can be added by repeating the steps. For example: auth_request_set $my_header $upstream_http_my_header; proxy_set_header my-header $my_header; ``` + +#### x-tinyauth-location + +For API requests (non-browser requests), Tinyauth sets the `x-tinyauth-location` header in error responses. This header contains the URL where Tinyauth wants the user to be redirected, such as `/login`, `/unauthorized`, or `/error` endpoints with appropriate query parameters. + +This header is particularly useful for Nginx configurations where the error page handler can read this header and redirect accordingly, instead of hardcoding redirect URLs in the Nginx configuration. For example: + +```shell +error_page 401 = @tinyauth_error; +error_page 403 = @tinyauth_error; +error_page 500 = @tinyauth_error; + +location @tinyauth_error { + auth_request_set $redirect_url $upstream_http_x_tinyauth_location; + return 307 $redirect_url; +} +```