Google storage – CORS – Stack Overflow
Im developing web app and chrome extensions with react app(CRA).
I want users to upload files to google storage bucket directly from the front-end.
The BE generates signed url to the front-end.
front-end then making PUT request to the gcloud storage bucket.
Backend code look like this:
url = blob.generate_signed_url(expiration=expiration_date, method='PUT', content_type=content_type, version='v4')
Issue:
From the localhost webapp(localhost:3000) im getting cors errors on upload files. however from the chrome extension(same code) it succeeded.
Some more info:
- cors config on the bucket includes localhost:3000 and still fails.
cors_config:
– maxAgeSeconds: 3000
method:
– PUT
– POST
– GET
– HEAD
origin:
– localhost:3000
- I tried with signed url v2 and v4. also i verified that content type is correct.
- front-end request to the bucket includes “Content-Type” header.
Any ideas what am i missing?
Read more here: Source link
