I'm trying to upload a file to GCS from the browser using a signed URL.
I've set the CORS policy on the bucket:
$ gsutil cors get gs://some-bucket/
[{"maxAgeSeconds": 3600, "method": ["HEAD", "GET", "OPTIONS", "PUT"], "origin": ["*"], "responseHeader": ["Access-Control-Allow-Origin", "Content-Length", "Content-Type", "User-Agent", "x-goog-resumable"]}]
Then I generate a signed URL:
$ gsutil signurl -m PUT -c application/octet-stream -d 1d credentials.json gs://some-bucket/data.txt
https://storage.googleapis.com/...
But when I do an OPTIONS
call on the bucket, I don't see the CORS headers:
$ curl -i -X OPTIONS -H 'Content-Type: application/octet-stream' https://storage.googleapis.com/...
HTTP/2 200
x-guploader-uploadid: ADPycdsFHRQM8pa4O7veziiugor92S82cN7Ov2S5XhbycQ2x_PwAPhWnhssvdYeoyW01SMOSwMeZIAtxQsxKLLokBlgo4kCNRQ
date: Sun, 19 Dec 2021 10:52:39 GMT
expires: Sun, 19 Dec 2021 10:52:39 GMT
cache-control: private, max-age=0
content-length: 0
server: UploadServer
content-type: text/html; charset=UTF-8
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
I can't figure out what am I doing wrong. Any help is appreciated.