This new question is just because my old question was closed. So I can't even answer it.
Javascript fetch using a download URL from GCS
I seldom get into situation where I have to consider CORS so I forget about it. But here is what is happening.
I get a download URL for a file on GCS, using
fileRef.getDownloadURL()
.This URL works when opening it in a Chrome tab.
However trying to use JavaScript
fetch
fails because of (bad) CORS.In principle this could be cured with
gsutil cors set ...
(see the question above).However because I am using the test environment (
firebase serve
,localhost
) it does not seem possible to set a value for the origin in the request header that is accepted bygsutil
.
So if someone knows a solution to 5 above I would be grateful. (I can use a workaround, of course, but I would prefer not.)
BTW, I tried to use the suggested proxy server, but it seems to be blocked here.
EDIT: I have also filed a bug report to Google. But it would be nice if I was wrong and this was not a bug in the interplay between Firebase local testing and GCS.