nginx自定义header支持

时间:2021-04-10 04:42:40

今天配置nginx的时候遇到一个问题,直接访问接口没有问题,但是通过nginx转发之后,总是报token失效,无法获取token值,发现请求头丢失了。

默认是不支持非nginx标准的用户自定义header的,如果需要
在http段或者server段加underscores_in_headers on;
http {
underscores_in_headers on;
server {
location / {
proxy_pass http://bank/;
proxy_set_header app_key ${http_app_key};
}
}
}