Cross Origin Resource Sharing (CORS) allows interactions between resources from
different origins, something that is normally prohibited in order to prevent
malicious behavior. This page explains how to configure CORS on a
Cloud Storage bucket for a sample origin, the origin of the online
[Shaka](https://shaka-player-demo.appspot.com/demo/) media player.
To [enable cross-origin resource
sharing (CORS) on a Cloud Storage bucket](https://docs.cloud.google.com/storage/docs/using-cors#configure-cors-bucket), do the following:

1. Create a JSON file that contains the following:

   ```
   [
     {
       "origin": ["https://shaka-player-demo.appspot.com/"],
       "responseHeader": ["Content-Type", "Range"],
       "method": ["GET", "HEAD"],
       "maxAgeSeconds": 3600
     }
   ]
   ```
2. Run the following command after replacing `JSON_FILE_NAME` with the name of the JSON file you created in the previous step:

   ```
   gcloud storage buckets update gs://BUCKET_NAME --cors-file=JSON_FILE_NAME.json
   ```