创建自定义 nginx.conf 以支持 CORS
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
您可以将 Extensible Service Proxy (ESP) 配置为支持 CORS(请参阅向 ESP 添加 CORS 支持)。如果 ESP 选项未提供应用所需的 CORS 支持,您可以将 CORS 选项添加到 ESP 的配置文件 nginx.conf
中。
将 CORS 选项添加到 nginx.conf
要添加 CORS 选项,请执行以下操作:
首先找到包含 Cloud Endpoints 所需配置的 nginx.conf
文件。您可以从示例 nginx.conf
入手;如果您已经部署了 ESP,则可以通过 SSH 连接到 ESP 容器,然后从 /etc/nginx/endpoints/
目录中复制 nginx.conf
文件。
将应用所需的 CORS 选项添加到 nginx.conf
。您可从在 NGINX 上使用 CORS 示例入手。
使用 --nginx_config
选项启动 ESP,其中的路径设置为指向自定义 nginx.conf
文件。
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-12-10。
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]