Come descritto in Aggiunta del supporto CORS a ESP, puoi configurare il proxy di servizio estendibile (ESP) per supportare CORS.
Se le opzioni ESP non forniscono il supporto CORS richiesto dalla tua applicazione, puoi aggiungere le opzioni CORS al file di configurazione di ESP,nginx.conf.
Aggiunta delle opzioni CORS a nginx.conf
Per aggiungere le opzioni CORS:
Inizia con un file nginx.conf contenente la configurazione richiesta da Cloud Endpoints. Puoi iniziare con il nginx.conf di esempio oppure, se hai già implementato ESP, puoi connetterti tramite SSH al contenitore ESP e copiare il file nginx.conf dalla directory /etc/nginx/endpoints/.
Aggiungi le opzioni CORS richieste dalla tua applicazione a nginx.conf. Puoi
utilizzare l'esempio CORS su NGINX come punto di partenza.
Avvia ESP con l'opzione --nginx_config e il percorso del file personalizzatonginx.conf.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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."]]],[]]