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
Copy file name to clipboardExpand all lines: docs/reference/headers.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,20 @@ Tinyauth adds the following headers in the authentication response to make authe
8
8
9
9
The `Remote-User` is a header set by tinyauth in the response containing the email address/username of the currently logged in user, this can be helpful in some apps that allow authentication from the reverse proxy.
10
10
11
+
### Custom headers
12
+
13
+
You can set the `tinyauth.headers` label on any container that uses the tinyauth middleware and it will automatically add them to its response. For example, you can have the following line in your app's labels:
14
+
15
+
```yaml
16
+
tinyauth.headers: My-Header=cool
17
+
```
18
+
19
+
And when you authenticate to your app through tinyauth, your app will receive the `My-Header` header.
20
+
21
+
::: warning
22
+
Make sure to create a list of trusted proxy URLs that your app accepts headers from. If your app trusts all proxies then anyone can just send the header to your app and possibly bypass any authentication you have set.
23
+
:::
24
+
11
25
## Adding headers to proxy
12
26
13
27
You firstly need to tell your proxy to forward the header. This varies from proxy to proxy.
@@ -17,15 +31,15 @@ You firstly need to tell your proxy to forward the header. This varies from prox
traefik.http.middlewares.tinyauth.forwardauth.authResponseHeaders: Remote-User # This can be a comma separated list of more headers you will like to copy like the custom ones you set
21
35
```
22
36
23
37
### Caddy
24
38
25
39
Just add the following label in the caddy labels:
26
40
27
41
```yaml
28
-
caddy.forward_auth.copy_headers: Remote-User
42
+
caddy.forward_auth.copy_headers: Remote-User # This can be a comma separated list of more headers you will like to copy like the custom ones you set
29
43
```
30
44
31
45
### Nginx/Nginx Proxy Manager
@@ -36,3 +50,10 @@ Add the following lines after the `error_page 401 = @tinyauth_login;`:
0 commit comments