We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7266a94 commit 3baeff2Copy full SHA for 3baeff2
src/cors.ts
@@ -0,0 +1,16 @@
1
+export const corsHeaders = {
2
+ 'Access-Control-Allow-Origin': '*',
3
+ 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
4
+ 'Access-Control-Allow-Headers': 'Authorization, Content-Type, X-Starbase-Source',
5
+ 'Access-Control-Max-Age': '86400',
6
+};
7
+
8
+export function corsPreflight(request: Request) {
9
+ // Handle OPTIONS preflight request first
10
+ if (request.method === 'OPTIONS') {
11
+ return new Response(null, {
12
+ status: 204,
13
+ headers: corsHeaders
14
+ });
15
+ }
16
+}
0 commit comments