我在 Google Play 和 App Store 中有多个应用程序。这些发送自定义请求 header ,但这些 header 包含下划线,例如“api_key”。
服务器现在已从 Apache 上的 PHP 5.2 移动到 nginx 上的 PHP 5.5。在 nginx 上,apache_request_headers() 和 getallheaders() 不可用。
有什么方法可以在 nginx 服务器上读取自定义请求 header ,而不必去更新所有应用程序以删除下划线?解析 $_SERVER 变量也不起作用 - 使用和下划线的任何 header 都被删除....
最佳答案
您需要在 nginx 配置中设置 underscores_in_headers on
。
http://wiki.nginx.org/HttpCoreModule#underscores_in_headers
关于php - 在nginx上获取带下划线的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26938604/