Skip to content

Debugging

Fix a CORS error properly

The browser blocks a request, and the quick fix is to allow everything.

What you get
The reason this request is blocked, and the narrowest setting that lets it through.
Paste it into
Your AI tool, in your project
The prompt
The browser console shows a CORS error when my frontend calls [the API or service].

Explain in two sentences what the browser is refusing and why. Then find out which case this is: my own API missing the right headers, a preflight request that isn't answered, cookies sent without credentials being allowed, a redirect in the middle, or a third-party API that has to be called from my server instead of the browser.

Fix it in the right place with the narrowest rule: my real origins only, no wildcard. If the request belongs on the server, move it there and keep the key out of the browser. Show me the response headers after the fix.

Use it

Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in. Replace the parts in [brackets] with your own details first.

More in Debugging