Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Cross Origin Resource Sharing (CORS) memungkinkan interaksi antar-resource dari asal yang berbeda, hal yang biasanya dilarang untuk mencegah perilaku berbahaya. Halaman ini menjelaskan cara mengonfigurasi CORS di bucket Cloud Storage untuk origin contoh, origin pemutar media Shaka online.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-03 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.\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 ```"]]