Skip to content

Fix logout cookie domain mismatch in OAuth mode#90

Merged
KrisSimon merged 5 commits intomainfrom
feature/logout-fix
Feb 18, 2026
Merged

Fix logout cookie domain mismatch in OAuth mode#90
KrisSimon merged 5 commits intomainfrom
feature/logout-fix

Conversation

@KrisSimon
Copy link
Copy Markdown
Contributor

@KrisSimon KrisSimon commented Feb 17, 2026

Summary

  • The logout was hardcoding the cookie domain to Constants.PUBLIC_DOMAIN, while login sets it from the request Host header. This caused the browser to receive an expired cookie for the wrong domain (e.g. login.a.com instead of login.b.com), leaving the original session cookie intact and the user still logged in after redirect.
  • The fix uses req.headers.first(name: "host") for OAuth mode, matching the login cookie domain logic.

Test plan

  • Verify logout clears the session cookie on multi-subdomain deployments (e.g. login.a.com)
  • Verify logout still works on single-domain deployments where Host matches PUBLIC_DOMAIN
  • Verify interceptor-mode logout is unaffected
  • Run existing unit tests (LoginControllerLogoutTests)

The logout was hardcoding the cookie domain to Constants.PUBLIC_DOMAIN,
while the login sets it from the request Host header. This caused the
browser to receive an expired cookie for the wrong domain, leaving the
original session cookie intact.
When a user logs in via interceptor mode (cookie on e.g. .feature.gcb-cloud.de)
but navigates directly to /logout (detected as oauth mode), the cookie domain
fell back to the host header instead of the tenant's interceptor cookieOrDomain.
This caused the browser to ignore the Set-Cookie and keep the session alive.

Now both logout branches check tenant.config.interceptor?.cookieOrDomain first,
aligning with the login controller's setCookieDomain logic. Also adds the
missing forwardInfo fallback to the interceptor branch.

Includes unit test and e2e regression test for Egg wildcard tenant logout.
@KrisSimon KrisSimon merged commit 76affcf into main Feb 18, 2026
7 checks passed
@KrisSimon KrisSimon deleted the feature/logout-fix branch February 18, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants