Repository navigation
website/docs: Enhance reverse proxy NGINX configuration - #27774
Conversation
By adding it does fix missing Host on websocket and some /static paths. Because I've customise the external port and on the browser gets redirect to https://authentik. Signed-off-by: Michel Lao <[email protected]>
👷 Deploy request for authentik-storybook accepted.
|
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
dominic-r
left a comment
There was a problem hiding this comment.
Thanks for the PR! I don't think we should merge this as is. The current example already sets Host $http_host (which keeps a custom external port) and handles WebSocket upgrades on every path, so I'm not sure what broke in your setup. Could you share the config that redirected you to https://authentik?
A few problems with the split:
- Removing
Connection $connection_upgrade_keepalivefromlocation /makes nginx sendConnection: closeupstream, so thekeepalivein the upstream block stops working. - Limiting upgrades to
location /wsbreaks installs under a subpath (AUTHENTIK_WEB__PATH), and/wswithout a trailing slash matches more than intended. - The
/staticblock repeats/without adding anything.
If X-Forwarded-Host fixed something for you, adding that one header to the existing location / would be a smaller change we can look at.
upstream authentik {
server [::1]:9443;
# Improve performance by keeping some connections alive.
keepalive 10;
}
server {
listen 30016 ssl;
listen 30016 quic;
listen [::]:30016 ssl;
listen [::]:30016 quic;
server_name example.com;
location / {
proxy_pass https://authentik;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
#proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}With this configuration, my browser requests to https://authentik
Endpoints which point to https://authentik:
Also when X-Forwarded-Host and Host headers are sets, the app doesn't receive any host header and I receive the missing host header message. That why I end up with this configuration. |
|
Thanks, that explains it. With the The missing host error is probably HTTP/3: browsers on If that's the case, could you change this PR to only update the |
Removed redundant proxy settings for static assets and websocket locations. Signed-off-by: Michel Lao <[email protected]>
|
FYI: This changes the host for everyone, not just HTTP/3 setups. Could you keep |
Signed-off-by: Michel Lao <[email protected]>
|
Thanks for your help. I just discover this difference between HTTP/2 and HTTP/3. |
dominic-r
left a comment
There was a problem hiding this comment.
I've pushed up a commit. I'll approve and get this merged. Thanks for your contribution!
* main: (35 commits) providers/saml: share xml signature generation (#27786) tests/openid_conformance: upload JPEG screenshots (#27749) crypto: export certificate expiry as a Prometheus metric (#27771) core: bump openapitools/openapi-generator-cli from v7.26.0 to v7.27.0 in /packages/client-ts (#27663) core: bump openapitools/openapi-generator-cli from v7.26.0 to v7.27.0 in /packages/client-rust (#27662) core: bump goauthentik/fips-debian from `d363011` to `16c391c` in /lifecycle/container (#27368) web: bump body-parser from 1.20.6 to 1.20.9 (#27521) core: bump library/node from `6d2c7d5` to `438603b` in /website (#27709) core: bump library/nginx from `5ab5b0b` to `165ddde` in /website (#27710) web: bump postcss-selector-parser from 7.1.7 to 7.2.0 in /web (#27742) web: bump glob from 13.0.6 to 13.0.7 (#27744) web: bump colord from 2.10.0 to 2.11.0 (#27745) web: bump colord from 2.10.0 to 2.11.0 in /website (#27746) root: resolve squashed migrations' dependencies (#27751) ci: add django-migration-linter (#27748) core: bump deepmerge from 3.0.1 to 4.0.0 (#27767) website/docs: Enhance reverse proxy NGINX configuration (#27774) providers/oauth2: drop the GrantTypes session alias (#27788) website/integrations: add calendarbridge (#27779) website/integrations: add onecal (#27778) ...

Details
What does this PR change?
Separate location static assets and websockets for authentik on NGINX configuration. Also fixing missing Host on websocket and some /static paths. Because I've customise the external port and on the browser gets redirect to https://authentik.
Why is this change needed?
How was this tested?
Linked issues
Checklist
make all)make docs)