user10332687
user10332687

Reputation:

Google Cloud Storage cors policy allow-all

I'm trying to allow all origins using the following command:

gsutil cors set /tmp/cors.json gs://my_bucket

Would the proper json document be:

 [
    {
      "origin": ["*"]
    }
]

Or:

[
    {
      "origin": "*"
    }
]

Upvotes: 13

Views: 11282

Answers (2)

Wendeldw
Wendeldw

Reputation: 281

As reference,

  1. Open the Google Cloud Shell, in the Cloud Console.
printf '[{"origin": ["*"],"responseHeader": ["*"],"method":
["GET","POST","HEAD"],"maxAgeSeconds": 86400}]' > cors.json

gsutil cors set cors.json gs://<bucket_name>

Upvotes: 27

sideshowbarker
sideshowbarker

Reputation: 88398

It should be "origin": ["*"].

The origin value is expected to be an array, even if you only want to specify a single origin or only the * wildcard. See, e.g., the example at https://cloud.google.com/storage/docs/gsutil/commands/cors#description.

Upvotes: 9

Related Questions