Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



cors - Set a CORS JSON document for one or more buckets

cors - Set a CORS JSON document for one or more buckets

Synopsis

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

Description

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 folllowing:

[
  {
    "origin": ["http://origin1.example.com"],
    "responseHeader": ["Content-Type"],
    "method": ["GET"],
    "maxAgeSeconds": 3600
  }
]

The above JSON document explicitly allows cross-origin GET requests from http://origin1.example.com 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:

Get

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”.

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 info about CORS, see http://www.w3.org/TR/cors/ .

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.