Nginx会忽略带下划线的Header

HTML  2021-09-07 10:37  310  

nginx会忽略带下划线的header,官方对header的说明如下:

Syntax:	    ignore_invalid_headers on | off;
Default:    ignore_invalid_headers on;
Context:    http, server

Controls whether header fields with invalid names should be ignored. Valid names are composed of English letters, digits, hyphens, and possibly underscores (as controlled by the underscores_in_headers directive).


默认忽略非法的header,合法的header包括:字母、数字、杠(-)、或者下划线(默认禁用,通过 underscores_in_headers  参数指定)


推荐修改为符合要求的heder参数名,若一定要用下划线,可以在nginx.conf的http中允许转发带下划线的header:

nginx.conf:

ignore_invalid_headers off;



参考

http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers


发布于 2021-09-07 10:37, 最后修改于2021-09-07 10:39