Repository navigation
fix(http): replace User-Agent with X-Client-Info for CORS - #7
Merged
Merged
Conversation
User-Agent is a forbidden request header per the Fetch spec — browsers
either strip it silently or, worse, trip CORS preflight rejection
against servers that don't list it in `Access-Control-Allow-Headers`.
Supabase Kong (the gateway in front of any /functions/v1/* baseUrl)
only allows `authorization, x-client-info, apikey, content-type,
x-trpc-source`, so every SDK call from a browser was failing with:
Request header field User-Agent is not allowed by
Access-Control-Allow-Headers
`X-Client-Info` is the Supabase-blessed equivalent and is in Kong's
default allowed list. Same purpose (client identification), no preflight
breakage.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
1 of 3 tasks
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Jun 11, 2026
…#342) Picks up Scaffald/sdk#7. The previous SDK release (#6) unblocked the apikey-header check at Kong, but exposed a second CORS-preflight failure: the SDK was sending `User-Agent: scaffald-sdk-js/0.1.0`, which is a forbidden request header in browsers and isn't in Kong's `Access-Control-Allow-Headers` list. Browsers (esp. Safari) rejected the preflight with: Request header field User-Agent is not allowed by Access-Control-Allow-Headers The SDK now sends `X-Client-Info` instead, which Kong allows by default. Also bumps scaffald-app patch version to 1.10.1. Co-authored-by: Claude Opus 4.7 <[email protected]>
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.
Summary
User-Agentis a forbidden request header per the Fetch spec — browsers either strip it or trip CORS preflight rejection against servers that don't list it inAccess-Control-Allow-Headers.Supabase Kong (the gateway in front of any
/functions/v1/*baseUrl) only allowsauthorization, x-client-info, apikey, content-type, x-trpc-source. So every SDK call from a browser was failing with:Switches the SDK to
X-Client-Info, which is the Supabase convention and is in Kong's default allowed list. Same purpose (client identification), no preflight breakage.Discovery
Surfaced immediately after #6 shipped — the apikey-header fix unblocked one CORS issue and exposed this one. Live reproduction on app.scaffald.com magic-link.
Test plan
pnpm test src/__tests__/http-client.test.ts— 21/21 passpnpm build— clean dual-format emitX-Client-Infoappears in the built chunkBackwards compat
User-Agent: scaffald-sdk-js/0.1.0; they'll now seeX-Client-Info: scaffald-sdk-js/0.1.0. If any consumer was filtering logs on the User-Agent string, they'll need to switch.🤖 Generated with Claude Code