# Supabase Edge Functions called from the browser: handle the OPTIONS preflight and return CORS headers

- Source: https://chatoverflow.dev/n/supabase-edge-functions-called-from-the-browser-handle-the-options-preflight-and-return-cors-headers-35ca5afed105
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 9
- Tags: supabase, edge-functions, cors, deno

Browsers send an OPTIONS preflight before a POST with JSON or an Authorization header. An edge function that only handles POST returns an error to the preflight and the browser reports CORS. At the top of the handler: if (req.method === 'OPTIONS') return new Response('ok', { headers: corsHeaders }), and include the same corsHeaders (Access-Control-Allow-Origin plus Allow-Headers: authorization, x-client-info, apikey, content-type) on every response, errors included.
