Skip to content

Commit e77d1d9

Browse files
authored
chore: enrich header section for necessity of passing header and example in caddy (#18)
1 parent 9aaf6e8 commit e77d1d9

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

docs/community/caddy.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ services:
102102
caddy: (tinyauth_forwarder)
103103
caddy.forward_auth: tinyauth:3000
104104
caddy.forward_auth.uri: /api/auth/caddy
105+
caddy.forward_auth.copy_headers: Remote-User Remote-Name Remote-Email Remote-Groups # optional when you want to make headers available to your service
105106
106107
tinyauth:
107108
container_name: tinyauth

docs/reference/headers.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ sidebar_position: 3
44

55
# Headers
66

7-
Setting headers can be useful for authenticating to apps with the credentials from Tinyauth. While Tinyauth offers some defaults, it also allows you to set any headers you like that will be automatically returned in the authentication server response.
7+
Setting headers can be useful for authenticating to apps with the credentials from Tinyauth. While Tinyauth offers some defaults, it also allows you to set any headers you like that will be automatically returned in the authentication server response. This could be useful when your application supports header based authentication, where the app trusts the reverse proxy to provide the authentication and use the user information passed from the header.
8+
9+
Note that the headers mentioned here is not automatically sent to the apps unless you specify it on the reverse proxy middleware you are using. See the section below for how to specify passing header in your reverse proxy.
810

911
## Supported headers
1012

@@ -14,6 +16,10 @@ The `Remote-User` header contains the username of the currently logged in user.
1416

1517
If you are using an OAuth provider, Tinyauth will try to retrieve the `preferred_username` claim from the OIDC response. If it isn't included in the response, Tinyauth will make a pseudo one using your email address in the format of `username_domain.com`.
1618

19+
:::info
20+
Headers are case-insensitive. Therefore you can use either `Remote-User` or `remote-user` for specifying the header.
21+
:::
22+
1723
### Remote email
1824

1925
The `Remote-Email` header contains the email of the currently logged in user.
@@ -65,9 +71,11 @@ traefik.http.middlewares.tinyauth.forwardauth.authResponseHeaders: remote-user #
6571
Just add the following label in the Caddy labels:
6672

6773
```yaml
68-
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
74+
caddy.forward_auth.copy_headers: remote-user
6975
```
7076

77+
Multiple headers here are separated by space. Therefore multiple headers are passed like `remote-user remote-name remote-email remote-groups`
78+
7179
### Nginx/Nginx Proxy Manager
7280

7381
Add the following lines after the `error_page 401 = @tinyauth_login;`:

0 commit comments

Comments
 (0)