Supabase CLI 3.1.0: local Edge Functions must send their own CORS headers (November 9, 2026)
Supabase CLI 3.1.0: the local gateway no longer adds CORS headers to /functions/v1, so browser calls fail unless the function sends them.
What changed
Supabase CLI v3.1.0 (released November 9) changes how the local stack handles CORS, to match the hosted platform:
- On
/functions/v1the gateway no longer addsAccess-Control-Allow-Origin: *. A function that sends no CORS headers will be blocked by browsers. - Preflight requests now return
200instead of204.
It also adds SUPABASE_API_MAX_RETRIES, which caps Management API retries (set 0 in CI to send each request once), and linked db commands now check the hosted server certificate against the pinned Supabase CA.
Prerequisites
- Supabase CLI 3.1.0 or later (
npm install supabase@3.1.0 --save-dev) - An Edge Function that is called from a browser, for example one that calls an AI API for your frontend
Steps
- Upgrade the CLI to 3.1.0.
- In each Edge Function your browser code calls, answer
OPTIONSrequests and add CORS headers such asAccess-Control-Allow-Originto every response. - Optional: set
SUPABASE_API_MAX_RETRIES=0in CI.
Test it
Run supabase start and supabase functions serve, then call the function from your web app. If the browser console shows a CORS error, the function is not sending its own headers yet.
Not confirmed
The release notes do not give a sample CORS header set; check Supabase's Edge Functions CORS guide for the headers your app needs.
