mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-06 20:59:07 -05:00
[GH-ISSUE #1740] Oidc cookie wrong #1995
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @smeretech on GitHub (Oct 24, 2025).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/1740
Describe the Bug
Hello
I am also encountering the same problem issues to the previous ticket #1644.
I should point out that I have version 1.11 and the idc is Authentik.
When accessing the baseurl, the problem does not occur because the oidc cookie remains correctly valued with the baseurl domain and, in the callback passage from Authentik, it maintains the session and, above all, the oidc cookie.
The real problem is with the use of other third-level domains where there are resources that Pangolin has to manage.
When logging in to resource1.domain.it:
Pangolin sets the status cookie:
p_oidc_state=...; Domain=resource1.domain.it; SameSite=lax
The Callback:
Authentik (correctly) redirects to Pangolin's baseURL: https://pangolin.domain.it/auth/.../callback
The cookie then disappears:
The browser must go to pangolin.domain.it. It looks at the cookie it has saved and sees Domain=resource1.domain.it.
The browser refuses to send that cookie for two reasons:
• Reason 1 (The Main Block): The domains do not match.
• Reason 2 (The Secondary Block): The redirection from Authentik is "cross-site," and the cookie is SameSite=lax. This also blocks it.
I created some http-response replace-value rules upstream of Pangolin (HAproxy) so that they intercept the p_oidc_state cookie (and only that one) and transform it from:
Domain=resource1.domain.it; SameSite=lax
to
Domain=.domain.it; SameSite=None; Secure
With the rules active and setting the cookie_domain to .domain.it in the config file:
Now there is an infinite loop.
Environment
To Reproduce
Pangolin sets the status cookie:
p_oidc_state=...; Domain=resource1.domain.it; SameSite=lax
Authentik (correctly) redirects to Pangolin's baseURL: https://pangolin.dominio.it/auth/.../callback
Expected Behavior
Generate a oidc cookie based to the first level of the domain (.domain.it) and solve the session cookie.
@github-actions[bot] commented on GitHub (Nov 8, 2025):
This issue has been automatically marked as stale due to 14 days of inactivity. It will be closed in 14 days if no further activity occurs.
@github-actions[bot] commented on GitHub (Nov 22, 2025):
This issue has been automatically closed due to inactivity. If you believe this is still relevant, please open a new issue with up-to-date information.
@88plug commented on GitHub (Dec 6, 2025):
Workaround using Traefik Proxy Cookie plugin
This bug bricked my first Pangolin install - added a resource with "Accept Clients" enabled and immediately got locked into a redirect loop. Couldn't access the dashboard at all, had to nuke the config and start fresh.
The root cause:
p_session_tokencookie is scoped to the exact hostname (Domain=example.com) instead of the wildcard (Domain=.example.com), so subdomain resources with Badger auth can't see the session cookie → infinite redirect. This affects any deployment, not specific to any proxy/CDN setup.Fixed it with traefik-plugin-proxy-cookie to rewrite cookie domains at the Traefik layer:
traefik.yml:
dynamic_config.yml:
This intercepts
Set-Cookieresponses and rewrites the domain to include the leading dot, making the session cookie valid across all subdomains. Works for both regular auth and OIDC flows.