Wrangler: blocked by CORS policy: The 'Access-Control-Allow-Origin' header

When testing locally via Wrangler, I get a CORS error for making a fetch to YouTube. in the client-side HTML page (in ./public/index.html NOT via Workers, but pure frontend). But when I use the the same HTML directly in the browser, it works as intended, with the results of the API call. I already added Access-Control-Allow-Origin: * in the ./public/_headers file.
2 Replies
tombyrer
tombyrerOP4w ago
anyone?
tombyrer
tombyrerOP3w ago
GitHub
wrangler-bug-local-cors · Issue #9276 · cloudflare/workers-sdk
Which Cloudflare product(s) does this pertain to? Wrangler What versions & operating system are you using? Wrangler ~4.14.1, Win11, Bun Please provide a link to a minimal reproduction https://g...

Did you find this page helpful?