Como se describe en Agrega la compatibilidad con CORS al ESP, puedes configurar el proxy de servicio extensible (ESP) para que sea compatible con CORS.
Si las opciones del ESP no proporcionan la compatibilidad con CORS que la aplicación necesita, puedes agregar las opciones de CORS al archivo de configuración del ESP, nginx.conf.
Agrega las opciones de CORS a nginx.conf
Para agregar las opciones de CORS, sigue estos pasos:
Comienza con un archivo nginx.conf que contenga la configuración que requiere Cloud Endpoints. Puedes comenzar con la nginx.conf de muestra, o si ya implementaste el ESP, puedes establecer una conexión SSH al contenedor del ESP y copiar el archivo nginx.conf. del directorio /etc/nginx/endpoints/.
Agrega las opciones de CORS que necesite tu aplicación a nginx.conf. Puedes usar el ejemplo CORS en NGINX como punto de partida.
Inicia el ESP con la opción --nginx_config mediante la ruta de acceso al archivo nginx.conf personalizado.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-03-25 (UTC)"],[[["You can configure the Extensible Service Proxy (ESP) to support CORS, as described in the documentation for adding CORS support to ESP."],["If ESP options don't meet your application's CORS needs, you can customize CORS by adding options directly to ESP's `nginx.conf` configuration file."],["To add custom CORS options, begin with a `nginx.conf` file required by Cloud Endpoints, such as the sample one, or by retrieving it from a deployed ESP container."],["After adding your custom CORS settings to `nginx.conf`, start ESP using the `--nginx_config` option, pointing to your modified configuration file."]]],[]]