Serve client-metadata.json with CORS — hosted-origin Bluesky sign-in was broken#41
Merged
Conversation
… was broken BrowserOAuthClient.load() fetches the client_id URL from the browser, which is cross-origin from my.pantryhost.app. pantryhost.app served the metadata without Access-Control-Allow-Origin, so hosted-origin Bluesky sign-in failed with "Failed to fetch" before OAuth even started — every successful sign-in to date happened on loopback, where the client is constructed locally. Exposed by the publish-broker rollout (#38), which makes my.pantryhost.app the sign-in origin for self-hosted publishers. Workers static assets honor public/_headers (verified via wrangler dev: ACAO * present on the response). Public document, no credentials. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
pantry-host-marketing | 5483fc0 | Jul 13 2026, 12:52 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
pantry-host-web | 5483fc0 | Commit Preview URL Branch Preview URL |
Jul 13 2026, 12:53 AM |
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.
What
Adds
packages/marketing/public/_headersso/client-metadata.jsonis served withAccess-Control-Allow-Origin: *.Why
BrowserOAuthClient.load({ clientId })fetches the client_id URL from the browser. Onmy.pantryhost.appthat's a cross-origin fetch topantryhost.app, which served the metadata with no CORS header — soBlueskyAuthinit fails withTypeError: Failed to fetchand hosted-origin sign-in never gets to the OAuth dance. Every successful sign-in so far happened on loopback (127.0.0.1), where the client is constructed locally without fetching metadata.The publish-broker rollout (#38, merged) makes
my.pantryhost.appthe sign-in origin for all self-hosted publishers, so this is now load-bearing: reproduced on the live site — console shows the init failure on/publish-broker.Verification
vite buildcopies_headersintodist/wrangler dev(Workers assets honor_headers):curl -I -H "Origin: https://my.pantryhost.app" http://localhost:8788/client-metadata.json→Access-Control-Allow-Origin: *✅https://pantryhost.app/client-metadata.json, then confirm sign-in works onhttps://my.pantryhost.app/publish-brokerThe client metadata is a public document fetched without credentials —
*is the correct scope.🤖 Generated with Claude Code