Cloudflare DevelopersCD
Cloudflare Developersโ€ข9mo agoโ€ข
2 replies
tombyrer

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.
Was this page helpful?