The Prompt BakeryTemplates and prompts

Fix · Supabase and databases

CORS error when my website calls Supabase or an Edge Function

Blocks your work

What you may see

  • The console says blocked by CORS policy
  • A request works in a tool like Postman but not in the browser

Most likely cause

A browser asks the server first whether your website's address may call it; the server answered without the allow headers, or the real error hides behind the CORS message.

Check first (about two minutes)

  1. Open the browser network tab: is there an OPTIONS request first, and what status does it have?
  2. Check the real status of the second request: a 401, 404 or 500 often shows up as CORS.

The fix prompt

What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.

Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.

Prompt language

Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.

After you tried it, did it work?

Steps

  1. Find which address the browser calls and what the OPTIONS answer is.
  2. For Supabase's own data API, check the project address and keys are right (a wrong address looks like CORS).
  3. For an Edge Function or my own server route, add an OPTIONS handler and the allow headers (origin, headers, methods) to EVERY response, including errors.
  4. Allow only my site addresses, not a star for everyone.

Do not do this

  • Do not set the allowed origin to * for functions that use cookies or private data.
  • Do not install a browser extension that turns CORS off, as a fix.

Related

Try another entry

How can we help?

What do you need?
Your email, so we can reply (optional)Only enter your own email. We reply there.