nginx代理服务器, 客户端发出的请求头被直接过滤了,当时想到nginx会自动过滤掉带有_
的请求头信息,所以直接改了Nginx的配置也可以将request中header中的_
改为-
步骤
修改nginx配置,在http中增加:
# vim /usr/local/nginx/conf/nginx.conf
underscores_in_headers on;
vhost中的配置如下:
location / {
proxy_set_header Host $host:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header x-forwarded-for $remote_addr;
proxy_pass http://xxxxxxx/;
}
建议:headers中的参数最好使用 - 或者 使用小驼峰命名。