Configurar el uso compartido de recursos entre dominios (CORS)
Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
El uso compartido de recursos entre dominios (CORS) permite interacciones entre recursos de diferentes orígenes, algo que normalmente está prohibido para evitar comportamientos maliciosos. En esta página se explica cómo configurar CORS en un segmento de Cloud Storage para un origen de ejemplo, el origen del reproductor multimedia online Shaka.
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-21 (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 ```"]]