关于生产环境token闪退的问题查到原因了、nginx默认过滤下划线的字段

原因:nginx默认requestheader内容参数下划线时会自动忽略掉,需要添加以下配置到http中
 underscores_in_headers on; #默认 underscores_in_headers 为off,表示如果header name中包含下划线,则忽略掉
(1)
生成token的时候报文头里会增加 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;
}

 

posted @ 2021-07-22 20:23  Jim-vue  阅读(205)  评论(0编辑  收藏  举报