12 Replies
Huh, this may be a bug. Can you check your DevTools and see what the value of the Access-Control-Allow-Origin header is in the response from R2?

Hi Sid, thanks for the response
Is there a preflight request as well? If so, that’s where the header would be
i cant find that
ok - interesting
I just changed to Edge because Chrome was doing normal jank stuff - the error is not in Edge and the file is shown.
That point to a Chrome bug, but that’s still super weird
Let me see if I can repro too
But generally, we set that header’s value to the hostname where the request came from (if that hostname is present in your CORS rules)
So you getting back localhost:8081 (allegedly, according to the error messages from Chrome) instead of localhost:8080 (where you’re making the request from) is the issue here
Thats correct
I can be running on port 8083 as well and the same thing happens - only way around is to force it to run in 8081 port which isnt helpful. I thought I might have structured the CORS policy incorrectly, but I'm pretty sure its correct? It does support multiple sources right?
It does, yep.
ok - cool. It's pretty much got to be down to Chrome I think. Always something right? Thanks and have a great weekend!
I have had this issue before, when using an R2 or GCP bucket with multiple origins in cors policy and also caching on cloudflare.
Since the origin is in the response headers, its also cached when you open it from one domain in the browser
I tried Vary: Origin header but it doesnt work always
The only proper workaround I found for this is to add the origin or something in the query string with the URL.
If anyone from CF is aware of any other solution, it would be helpful
Thanks for the repsponse!
Thank you for this, have been encountering this issue for the past couple of weeks and this work around works!