php - 在nginx上获取带下划线的标题

标签 php nginx

我在 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/

相关文章:

php - 我如何在 php 中回显商品价格

php - 使用 MySQL 在聊天消息数据库中建立公共(public)连接

php - 使用外部 php 脚本进行检查

php - SQL ORDER String (NumberOrder/CurrentYear) 来自两个表

nginx - 在 Nginx 代理后面的 Vagrant 上设置 Spring boot 应用程序

nginx - 主机的 Kubernetes Ingress 白名单 IP

javascript - 如何使图像 slider 进入while循环

php - nginx 本地网络服务器的所有权和权限

php - Nginx 的 fastcgi-php.conf 片段丢失

ruby-on-rails - 到 'ws://example.com/cable' 的 WebSocket 连接失败 : Unexpected response code: 404