I'm using Netlify to serve some static .json
files. They load fine in the browser but when I try to fetch them via javascript I get the following error in the console:
Access to fetch at (redirected from ) from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I checked all the options in my site's settings in the Netlify dashboard and don't see any options to enable CORS, how can this be done?
/* Access-Control-Allow-Origin: *
in a file called_headers
(no extension) and putting it at the root next to an index.html (not sure if this bit is needed but I followed the comment) worked. If you want to post that as an answer I'll accept!