宝塔Nginx反代没有Cookie的问题

添加Header

proxy_set_header Cookie $http_cookie;

示例配置

#PROXY-START/
location ~* \.(php|jsp|cgi|asp|aspx)$
{
    proxy_pass https://127.0.0.1;
    proxy_set_header Host baidu.com;
    proxy_set_header Cookie $http_cookie;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
}
location /
{
    proxy_pass https://127.0.0.1;
    proxy_set_header Host baidu.com;
    proxy_set_header Cookie $http_cookie;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;

    add_header X-Cache $upstream_cache_status;
    #Set Nginx Cache
    proxy_ignore_headers Set-Cookie Cache-Control expires;
    add_header Cache-Control no-cache;
    expires 12h;
}

#PROXY-END/

人已赞赏
Linux

Linux配置常用源

2020-11-17 22:16:59

开发工具

SourceTree跳过Atlassian账号,免登陆,跳过初始设置

2020-12-12 9:48:00

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索