客户端在请求时在http请求的header中加入了一些自定义参数,但是以net_,os_,device_开头的一些参数在后端无法获取到。后端使用的 php,打印$_SERVER没有这些参数
看了http协议和cgi协议也没有找到相关说明
不太明白怎么回事
3 回答
尚方宝剑之说
TA贡献1788条经验 获得超4个赞
找到原因了
不只是net_
,os_
,device_
开头的一些参数,默认情况下nginx会自动drop所有带下划线的header
需要设置 underscores_in_headers on;
If you do not explicitly set underscores_in_headers on;
, nginx will silently drop HTTP headers with underscores (which are perfectly valid according to the HTTP standard). This is done in order to prevent ambiguities when mapping headers to CGI variables, as both dashes and underscores are mapped to underscores during that process.
- 3 回答
- 0 关注
- 617 浏览
添加回答
举报
0/150
提交
取消