使用nginx过程中遇到了个问题,就是request中的header name中如果包含下划线会自动忽略掉,导致服务器接收不到该字段的内容,以下为解决方法:
nginx默认request的header内容参数下划线时会自动忽略掉,需要添加以下配置到http中
underscores_in_headers on;
这个配置默认值是 underscores_in_headers off; 是关闭状态,默认是如果header设置的key中的字符串,含有下划线,会忽略。
所以建议在http header设置的时候,避免试用下划线_,建议试用中横线-或者驼峰。