CORS and Assets

Hi,

I’m currently storing other types of files in Stroryblok Assets e.g. csv files.

Am I right in assuming I would need to create a proxy server to GET these files from the frontend as I am currently getting CORS errors?

Thanks,
Dan

Hello Dan,

can you post the error message(s) you get related to CORS, please?

Hey Hannes,

I wouldn’t waste any time on this issue. I suspect it is something to do with my environment! Firefox works fine, incognito Chrome works fine! I logged out of Storyblok and normal Chrome started working. I logged back into Storyblok and is still working in normal Chrome!

I think Chrome is having one of those days!

Regards,
Dan

Actually, scrub my last response…it’s not working again (seem very intermittent)!!! I’ve just re-run the app and am getting CORS errors again…

Access to XMLHttpRequest at 'https://a.storyblok.com/f/85015/x/bfbac59c55/test.csv' from origin 'http://localhost:3001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Hey Hannes,

I’ve just re-run the app to get the error, but now it is working! I’d put this one down to something failed on my end.

Thanks for responding so quicky though.

regards,
Dan

That is interesting. I observe this and similar behavior sometimes in combination with cache issues of browsers. This can also happen after browser updates. Sometimes it is needed to clean the cache completely.

With best regards,
Hannes

Hey there!

Indeed we do not allow that from our own a.storyblok.com domain, however you can use the example here to use the direct S3 domain instead: https://gist.github.com/DominikAngerer/dc9c7735021c13a4a05ee4752e3591ce which allows you to download it in the client. A proxy / custom domain would also allow you to achieve that.

Best
Dominik

1 Like