Nginx转发导致请求头丢失


第三方接口接入的时候,需要添加授权请求头,但是在使用nginx转发的时候,请求头丢失导致一些请求无法访问。

解决方法:

修改http模块,在模块中加入:

underscores_in_headers on;

 默认配置中,underscores_in_headers 是 off,关闭状态;

在location模块中加入:

location /{
    proxy_set_header Host $http_host;
}

相关