Skip to content

Commit c8c7f0d

Browse files
authored
docs: add headers reference and proxy configuration guide (#81)
Co-authored-by: dosubot[bot] <131922026+dosubot[bot]@users.noreply.github.com>
1 parent 9619297 commit c8c7f0d

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/content/docs/docs/reference/headers.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,20 @@ Additional headers can be added by repeating the steps. For example:
100100
auth_request_set $my_header $upstream_http_my_header;
101101
proxy_set_header my-header $my_header;
102102
```
103+
104+
#### x-tinyauth-location
105+
106+
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.
107+
108+
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:
109+
110+
```shell
111+
error_page 401 = @tinyauth_error;
112+
error_page 403 = @tinyauth_error;
113+
error_page 500 = @tinyauth_error;
114+
115+
location @tinyauth_error {
116+
auth_request_set $redirect_url $upstream_http_x_tinyauth_location;
117+
return 307 $redirect_url;
118+
}
119+
```

0 commit comments

Comments
 (0)