Comme décrit dans la section Ajouter la compatibilité CORS à ESP, vous pouvez configurer Extensible Service Proxy (ESP) afin d'assurer la compatibilité avec CORS.
Si les options ESP ne permettent pas la compatibilité avec le mécanisme CORS requise par votre application, vous pouvez ajouter les options CORS au fichier de configuration ESP nginx.conf.
Ajouter les options CORS à nginx.conf
Pour ajouter les options CORS, procédez comme suit :
Commencez avec un fichier nginx.conf contenant la configuration requise par Cloud Endpoints. Vous pouvez commencer avec l'exemple nginx.conf ou, si vous avez déjà déployé ESP, vous pouvez vous connecter en SSH au conteneur ESP et copier le fichier nginx.conf à partir du répertoire /etc/nginx/endpoints/.
Ajoutez les options CORS requises par votre application au fichier nginx.conf. Vous pouvez utiliser l'exemple CORS on NGINX (CORS sur NGINX) comme point de départ.
Démarrez ESP en spécifiant l'option --nginx_config avec le chemin d'accès au fichier personnalisé nginx.conf.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/03/25 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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."]]],[]]