Nginx如何解决cookie跨域


当前第2页 返回上一页

其实上述场景中 $.cookie("user", "hjzgg", {path: "/web"}); 中的path可以写成 “/”, 这样nginx的配置就更为简单了,如下。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

location /web1 {

            proxy_pass http://web1;

            proxy_set_header Host  127.0.0.1;

            proxy_set_header   X-Real-IP        $remote_addr;

            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

  

            proxy_set_header Cookie $http_cookie;

            log_subrequest on;

        }

  

        location /web2 {

            proxy_pass http://web2;

            proxy_set_header Host  127.0.0.1;

            proxy_set_header   X-Real-IP        $remote_addr;

            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

            proxy_set_header Cookie $http_cookie;

            log_subrequest on;

        }

更多Nginx相关技术文章,请访问Nginx使用教程栏目进行学习!

以上就是Nginx如何解决cookie跨域的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

nginx上出现403应该怎么解决

nginx怎么发音

nginx负载均衡原理

nginx常见错误及解决方法介绍

命令行方式启动nginx

nginx默认端口是多少

nginx/1.12.2是什么意思

nginx版本区别

welcome to nginx是什么意思

如何将nginx注册为服务

更多相关阅读请进入《nginx》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...