-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Describe the bug
When using the Proxy provider in forward-auth mode for an application that is hosted on a non-default port (for example https://app1.example.com:8443), the user is not redirected to the application after successful login, but gets redirected to the "My applications page".
To Reproduce
- Configure Authentik Proxy provider and Nginx in forward-auth mode according to docs for an application on non-defualt port.
- Visit the application while not logged in: go to
https://app1.example.com:8443 - You will be redirected to Authentik login page
- Log in
- You get redirected to
https://auth.exmaple.com/if/user/#/libraryinstead ofhttps://app1.example.com:8443
Expected behavior
After login, the user is redirected to the URL they were originally trying to visit
Version and Deployment (please complete the following information):
- authentik version: 2025.6.3
- Deployment: docker-compose
Additional context
I've been digging in the code and found the source of the bug:
| if !strings.HasSuffix(u.Host, *a.proxyConfig.CookieDomain) { |
The code is comparing URL.Host with a.proxyConfig.CookieDomain, which is wrong. URL.Hostname should be used instead.
According to docs, URL.Host contains the host and port, while Hostname returns only the host without the port. CookieDomain obviously does not contain the port. string.HasSuffix function is used, so this bug only appears when a non-default port is used in the redirected URL.