通过proxy_pass加载资源时,nginx不发送cookie,身份验证不起作用

时间:2019-07-29 19:37:10

标签: authentication nginx cookies browser-sync

我的两个前端都有反向代理。当我在端口4200上进行身份验证过程时,服务器向我发送了cookie,用户,然后分别将其放入浏览器cookie和localStorage中。

我正在使用nginx配置:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       1337 default_server;
        server_name  localhost;

        proxy_redirect           off;

        location / {
            proxy_pass http://127.0.0.1:4200/;
        }

        location /admin {
            proxy_pass http://127.0.0.1:4201/;
            try_files $uri $uri/ /index.html = 404;
        }
    }
}
通过浏览器同步作为开发服务器运行的

p.s http://127.0.0.1:4201/

http://localhost:1337/some-page上显示cookie的方式

browser console

以及如何http://localhost:1337/admin

browser console

预期结果:身份验证适用于http://localhost:1337/admin

0 个答案:

没有答案
相关问题