Use the gsutil cors command to configure CORS on a bucket:
gsutil cors set cors-json-file.json gs://example
Where cors-json-file.json contains:
[
{
"origin": ["*"],
"responseHeader": ["*"],
"method": ["GET", "POST", "PUT", "OPTIONS", "HEAD", "DELETE"],
"maxAgeSeconds": 3600
}
]
This is a DANGEROUS wildcard configuration. Use it only to test, then set your parameters correctly.
You can also use the gsutil cors command to get the CORS configuration of a bucket:
gsutil cors get gs://example
More info: https://cloud.google.com/storage/docs/configuring-cors