17 lines
628 B
TypeScript
17 lines
628 B
TypeScript
// server/supabase/functions/_shared/cors.ts
|
|
// Edge Function 공통 CORS 헤더
|
|
|
|
export const corsHeaders: Record<string, string> = {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Headers':
|
|
'authorization, x-client-info, apikey, content-type, idempotency-key, x-d3ro-generation-purpose',
|
|
'Access-Control-Allow-Methods': 'GET, POST, PATCH, DELETE, OPTIONS',
|
|
'Access-Control-Expose-Headers': 'x-d3ro-generation-id',
|
|
}
|
|
|
|
export function handleCorsPreflightRequest(req: Request): Response | null {
|
|
if (req.method === 'OPTIONS') {
|
|
return new Response('ok', { headers: corsHeaders })
|
|
}
|
|
return null
|
|
}
|