cors - Get or set a CORS JSON document for one or more buckets

cors - Get or set a CORS JSON document for one or more buckets


gsutil cors set cors-json-file url...
gsutil cors get url


Gets or sets the Cross-Origin Resource Sharing (CORS) configuration on one or more buckets. This command is supported for buckets only, not objects. An example CORS JSON document looks like the following:

    "origin": [""],
    "responseHeader": ["Content-Type"],
    "method": ["GET"],
    "maxAgeSeconds": 3600

The above JSON document explicitly allows cross-origin GET requests from and may include the Content-Type response header. The preflight request may be cached for 1 hour.

The following (empty) CORS JSON document removes all CORS configuration for a bucket:


The cors command has two sub-commands:


Gets the CORS configuration for a single bucket. The output from "cors get" can be redirected into a file, edited and then updated using "cors set".


Sets the CORS configuration for one or more buckets. The cors-json-file specified on the command line should be a path to a local file containing a JSON document as described above.

For more general information about CORS, see

For more information about CORS in Cloud Storage, see the CORS concept page.



ご不明な点がありましたら、Google のサポートページをご覧ください。