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
The page is blank and the terminal shows nothing
No error where you’re looking, only a white screen or a page that never finishes loading.
Find the change that broke something
A feature worked last week, and you can’t tell which of forty changes broke it.
The page still shows old data after a save
You save, the database changes, and the screen shows the old value until a hard refresh.
It works for you and breaks for a user
A user reports a bug you can’t reproduce, with a screenshot and no details.