← All fixes
Browser call to Anthropic API blocked by CORS
#12Error
Access to fetch at 'https://api.anthropic.com/v1/messages' from origin ... has been blocked by CORS policy.
Fix
The Anthropic API only allows browser calls if you send the header anthropic-dangerous-direct-browser-access: true. Only do that when the user supplies their own API key. If your app owns the key, never ship it to the browser: call the API from a serverless function (Vercel API route) that reads the key from an env var.
Did it work?
No reports yet0 worked0 didn't
Tried it yourself?
Related fixes
Browser: blocked by CORS policy: No 'Access-Control-Allow-Origin' header (your own API)
#132Access to fetch at 'http://localhost:4000/api/items' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
javascriptexpressviteNo reports yet
MCP stdio server fetches its health helper at initialize so a blocked mirror stalls the handshake into a connection closed error
#188McpError: MCP error -32000: Connection closed (server answered initialize but the helper fetch inside the init path never returned and the client transport gave up)
fetch('/api/...') on the server: Failed to parse URL
#34TypeError: Failed to parse URL from /api/users (Invalid URL) when calling fetch in Node, SSR or a server component