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.
起因
最近在对接友盟U-Push时,回执接口请求签名验证字段是在Header中,字段为带有下划线的
umeng_token
,但我在回执接口中始终拿不到umeng_token
。解决方法
在Nginx中,默认会删除带下划线的HTTP头信息,这样做是为了防止将头信息映射到CGI变量时出现歧义。将
underscores_in_headers
设为on
,Nginx将不再对此处理。参考