Repository navigation
fix(web): sign in again when an auth proxy's session ends - #216
Merged
Merged
Conversation
With Access's session expired, every API call is redirected to the Access sign-in on another domain, which a fetch cannot follow: the web UI, kept open on the Home Screen, only showed errors until it was reloaded by hand. The transport's fetch uses `redirect: "manual"`. A redirect (Spotarr's API never sends one) reloads the page, at most once a minute, and the browser follows it to the sign-in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MqWWDWYeR6E8VJqWwNY7wg
… Cloudflare Access The reload works for any auth proxy that redirects to its sign-in (Cloudflare Access, Authelia, Authentik, oauth2-proxy…): nothing in it checks Cloudflare. The names and comments now say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MqWWDWYeR6E8VJqWwNY7wg
mathieuletyrant
deleted the
claude/snag-pwa-cloudflare-session-t9uc85
branch
November 23, 2026 07:24
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #215
What
The Connect transport now uses its own
fetch(fetchThroughAuthProxy), which sends each call withredirect: "manual". If a call comes back as a redirect, the page reloads, at most once a minute. The browser then follows the auth proxy to its sign-in page.Nothing checks for Cloudflare. This works for any auth proxy that redirects to its sign-in page: Cloudflare Access, Authelia, Authentik, oauth2-proxy… Without a proxy, the redirect path never runs.
Why
Found with Cloudflare Access. Once its session ends, Access redirects every request to its sign-in page, which is on another domain. A page's
fetchcannot follow that redirect. The web UI kept open on the Home Screen then only showed errors until it was reloaded by hand. A full page load was never affected, because the browser follows the redirect itself.New notions, in plain words
redirect: "manual": the fetch does not follow a redirect. It returns a placeholder answer whosetypeis"opaqueredirect". Spotarr's API never redirects, so that answer always means the proxy in front wants a new sign-in.sessionStorage): if signing in keeps failing, the page does not reload in a loop.as typeof fetchcast: Bun's types addfetch.preconnect, which a browser fetch never uses.Checks
pnpm checkpasses locallyAlso checked in Chromium against a fake auth proxy that redirects with a 302 to another origin: after the session "expired", submitting the login form reloaded the page and landed on the fake sign-in page.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MqWWDWYeR6E8VJqWwNY7wg