[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-03。"],[],[],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.\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://BUCKET_NAME --cors-file=JSON_FILE_NAME.json\n ```"]]