fix: proxy API via Pages Function to fix iOS Safari guest sessions#22
Merged
pkmaster21 merged 2 commits intomainfrom Apr 16, 2026
Merged
fix: proxy API via Pages Function to fix iOS Safari guest sessions#22pkmaster21 merged 2 commits intomainfrom
pkmaster21 merged 2 commits intomainfrom
Conversation
…est sessions iOS Safari's ITP blocks Set-Cookie headers from cross-origin fetch() requests, even with SameSite=None; Secure, causing guest session tokens to never be stored. Adds a catch-all Pages Function that proxies /api/* to the backend API_URL so all requests are same-origin and cookies are treated as first-party.
Deploying tabby with
|
| Latest commit: |
16c06fa
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://38a79cf0.tabby.pages.dev |
| Branch Preview URL: | https://fix-ios-safari-guest-session.tabby.pages.dev |
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.
Problem
Guest sign-in was broken on mobile. After joining a group, navigating to the dashboard immediately showed "Session expired. Open the group link again to rejoin."
The root cause is iOS Safari's Intelligent Tracking Prevention (ITP). When the frontend (
tabby.pages.dev) makes a cross-originfetch()to the API withcredentials: 'include', Safari blocks theSet-Cookieresponse header — even withSameSite=None; Secureset correctly. The guest session token is never stored, so every subsequent API call returns a 401.Solution
Added a Cloudflare Pages Function (
functions/api/[[path]].ts) that proxies all/api/*requests to the backend at the edge. With the proxy in place, the frontend makes same-origin requests totabby.pages.dev/api/..., so cookies are first-party and Safari stores them normally.To complete the fix, update the Cloudflare Pages dashboard:
API_URL= the current value ofVITE_API_URL(the backend URL)VITE_API_URLto an empty string (or remove it)