Users reported an infinite SSO redirect loop on Safari (iOS and macOS) when accessing Discourse instances with login required and SSO enabled. The issue occurs after successful SSO login, where users are caught in a redirect cycle between Discourse and the SSO master site until Safari aborts. The problem does not occur in Chrome. sam identified the root cause: the same site cookies setting being set to Lax (default) triggers a Safari bug. Switching it to Disabled resolved the issue immediately for fefrei. Falco noted that a recent Safari Tech Preview (v77) may fix the bug, and LeoMcA confirmed the fix works on macOS Mojave and referenced a similar issue in Mozilla’s Discourse. Users are cautious about disabling same site cookies for security reasons, especially since CSRF protections may be weakened — though it’s considered a defense-in-depth measure. The community hopes Safari’s upcoming release will resolve the underlying bug without requiring configuration changes.
With multiple Discourse instances that have login required set and use SSO, we’re experiencing infinite redirects on login with Safari on iOS. Here’s what happens:
User is not logged in in Discourse or SSO master site.
User navigates to Discourse instance.
Discourse redirects to SSO page.
SSO page prompts for credentials. User logs in.
User is stuck in a redirect loop between the SSO master site and Discourse, until Safari gives up.
If the user then manually navigates to Discourse again, he is logged in.
I cannot reproduce this behavior with Chrome on the desktop.
While a client is in the redirect loop, multiple Started SSO process and User was logged on entries are generated, so it looks like the SSO process is successful, but somehow, after completing SSO, Discourse redirects the user to another SSO login, not to the start page.
This also affects old instances where SSO has worked fine before, so I do not think this is a Discourse configuration issue.
Does anyone have an idea what could be wrong here?
I have seen this on sites that have the setting same site cookies set to Strict, if it is already on Lax recommend attempting to disable and see if it works around the Safari bug.
You are % correct. It was on Lax, the default. Changing it to Disabled fixed the issue immediately. (I assume this is a defense-in-depth thing, on top of your usual CSRF protections, so disabling it is not overly terrible for security?)
This fixes my issue - at least on macOS Mojave - so I assume it fixes it on iOS too. Thanks!
I’d also like to know people’s opinions on this.
What with this being the Mozilla Discourse and all, we don’t have a huge amount of traffic from Safari, so don’t want to make ourselves vulnerable to CSRF attacks for something which will benefit a very small proportion of our users.