Home  >  Q&A  >  body text

After nginx completes the load, the login request repeats 302

There are two physical hosts a and b running tomcat respectively. The operating environments are both window. Host a runs nginx, and redis is also installed on a. If redis session sharing is not used, you can log in to either machine individually, but After using redis to share, request a host, and load nginx again, the login interface will be repeated. In addition, running demo to test session sharing is no problem. Search for 302nginx solutions and add rewrite ^/(.*) http ://www.downcc.com/$1 permanent;At this time, if I request host a again192.168.1.62/czzf, it will get 404, and the browser address bar will jump to http: //127.0.0.1/czzf

    upstream czzf{
        server 127.0.0.1:8080;
        server 192.168.1.100:9038 max_fails=1 fail_timeout=30s;
    }
    
    server {
        listen       80;
        server_name  127.0.0.1;
        rewrite ^/(.*) http://127.0.0.1/ permanent;

        location / {
            root   html;
            index  index.html index.htm;
            proxy_connect_timeout 10;
            proxy_pass http://czzf;
        }
    }
巴扎黑巴扎黑2713 days ago524

reply all(1)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-16 17:09:04

    server_name  127.0.0.1;
    rewrite ^/(.*) http://127.0.0.1/ permanent;

    You are already in an endless loop here.

    Remove rewrite.

    reply
    0
  • Cancelreply