Repository navigation
Browser session cookie: SameSite=Strict causes a redirect loop on iOS when the page is opened from another app #9096
Replies: 2 comments
|
|
"Spot on analysis. Hardcoding SameSite=Strict definitely causes top-level navigation issues when opening links from external apps on iOS. Moving to Lax or making it configurable makes complete sense for a smoother auth flow- especially when handling redirects or testing through tools like CroxyProxy." |
Uh oh!
There was an error while loading. Please reload this page.
Version:
@deepseek-ai/dsh0.1.5-rc.1What happens
dsh-client-connectionissues the browser session cookie withSameSite=Strict(sessionCookie()inpackages/client/connection/src/browser-auth.ts). On iPhone (iOS 26, Edge for iOS / WebKit), when the Web UI is opened from outside the browser (a link in another app, a home-screen shortcut, or a tab resumed after a while), WebKit treats the first navigation as cross-site (Sec-Fetch-Site: cross-site). It then withholdsStrictcookies for the whole redirect chain that follows:Under a front door that sends cookie-less visitors back through the token exchange, this becomes an endless loop. The browser stops after many hops with
ERR_FAILED. Opening the same URL by typing it (Sec-Fetch-Site: none) works. Desktop browsers are not affected.We know the design note (2026-08-24 browser-token-authentication) scopes support to loopback HTTP and says proxy deployment is not a supported contract. The cookie behaviour itself does not depend on the proxy, though: any cross-site top-level arrival at
/?token=…gets a cookie that the immediate303 /does not carry.Suggestion
Either of these would fix it:
SameSite=Lax. Top-level GET navigations still carry the cookie, and cross-site subresource requests and POSTs still do not. CSRF and DNS-rebinding protection already come from the Host/Origin checks that run before authentication (403), soStrictadds little on top of them.Strictas the default, but add a setting next tocookieMaxAgeDays(for examplecookieSameSite: "strict" | "lax").Current workaround
We rewrite the attribute at the reverse proxy (Caddy):
This fixed it for us. We would rather not depend on a string rewrite of a header the package owns.
All reactions