Stay organized with collections
Save and categorize content based on your preferences.
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 media player.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[],[],null,["# Configure cross-origin resource sharing (CORS)\n\nCross Origin Resource Sharing (CORS) allows interactions between resources from\ndifferent origins, something that is normally prohibited in order to prevent\nmalicious behavior. This page explains how to configure CORS on a\nCloud Storage bucket for a sample origin, the origin of the online\n[Shaka](https://shaka-player-demo.appspot.com/demo/) media player.\n| **Note:** Enabling cross-origin resource sharing is not necessary to use the Transcoder API, but you can use this guide to set up storage buckets so that you can review content from web-based players.\nTo [enable cross-origin resource\nsharing (CORS) on a Cloud Storage bucket](/storage/docs/using-cors#configure-cors-bucket), do the following:\n\n1. Create a JSON file that contains the following: \n\n ```\n [\n {\n \"origin\": [\"https://shaka-player-demo.appspot.com/\"],\n \"responseHeader\": [\"Content-Type\", \"Range\"],\n \"method\": [\"GET\", \"HEAD\"],\n \"maxAgeSeconds\": 3600\n }\n ]\n ```\n2. Run the following command after replacing \u003cvar translate=\"no\"\u003eJSON_FILE_NAME\u003c/var\u003e with the name of the JSON file you created in the previous step: \n\n ```\n gcloud storage buckets update gs://STORAGE_BUCKET_NAME --cors-file=JSON_FILE_NAME.json\n ```"]]