首页 > 系统相关 >生产环境下包含refresh_Token接口报错nginx配置

生产环境下包含refresh_Token接口报错nginx配置

时间:2023-01-05 11:13:06浏览次数:59  
标签:headers underscores refresh nginx Token 报错

一、问题现象

使用nginx代理项目,生产环境下,包含refresh_Token的接口报错,开发环境下却正常。

二、原因

nginx默认request的header内容参数下划线时会自动忽略掉,需要添加以下配置到http中underscores_in_headers on;

#默认 underscores_in_headers 为off,表示如果header name中包含下划线,则忽略掉

(1)接口请求的时候报文头里会增加 refresh_Token 字段,但是nginx默认过滤下划线的字段,所以导致刷新token的时候后台取不到refresh_Token,接口报错;

(2)测试环境没有走nginx代理所以没有测到这个问题;

三、解决方案:

nginx配置文件 在server模块下面增加配置命令 underscores_in_headers on;

在nginx.conf配置http中加上underscores_in_headers on配置

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    underscores_in_headers on;
    keepalive_timeout  65;
}

 

标签:headers,underscores,refresh,nginx,Token,报错
From: https://www.cnblogs.com/littleDinosaurs/p/17026966.html

相关文章