Skip to content

Commit 3c34f54

Browse files
Merge pull request #92 from richardthe3rd/claude/allow-staging-origins-01Az2QwJ7SDMkXGuF9Cey4kD
Allow staging domain in worker origins
2 parents 66b8724 + 255dc99 commit 3c34f54

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

cloudflare-worker/worker.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ function getCorsHeaders(request) {
226226
};
227227
}
228228

229+
// Allow Cloudflare Pages staging preview URLs (*.staging-cambeerfestival.pages.dev)
230+
// This includes branch-based staging deployments
231+
// Security note: Same as above - Cloudflare controls the .pages.dev namespace
232+
if (origin.endsWith('.staging-cambeerfestival.pages.dev')) {
233+
return {
234+
'Access-Control-Allow-Origin': origin,
235+
'Access-Control-Allow-Credentials': 'true',
236+
};
237+
}
238+
229239
// Reject all other origins by not including CORS headers
230240
return {};
231241
}

0 commit comments

Comments
 (0)