nginx reverse generation jump configuration problem
習慣沉默
習慣沉默 2017-05-16 17:11:14
0
1
599

I used nginx to reverse the generation of a tomcat application. When the ip is directly accessed, http://192.168.1.112:8282/bbs
The reverse generation is test-bbs.xx.com

When I log in, the bbs application will jump to the homepage with 302, which is http://192.168.1.2:8080/bbs
But when I use nginx, it jumps to test-bbs .xx.com/bbs

listen       80;
        server_name  test-bbs.xx.com;
        root    html;
        index   index.html;
        access_log  /usr/local/nginx/logs/bbs.access.log;
        error_log  /usr/local/nginx/logs/bbs.error.log;
        charset utf-8;
        location / {
                proxy_pass http://192.168.1.112:8282/bbs/;
                proxy_redirect off;
                proxy_set_header HOST $host:$server_port;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                client_max_body_size 100m;
                client_body_buffer_size 128k;
                proxy_connect_timeout 900;
                proxy_send_timeout 900;
                proxy_read_timeout 900;
                proxy_buffer_size 4k;
                proxy_buffers 4 32k;
                proxy_busy_buffers_size 64k;
                proxy_temp_file_write_size 64k;
        }
習慣沉默
習慣沉默

reply all(1)
过去多啦不再A梦

Already solved it myself
Add proxy_redirect http://test-bbs.xx.com/bbs/ /;proxy_redirect http://test-bbs.xx.com/bbs/ /;
又碰到另外一个问题,就是反代后session丢失。
解决办法
添加 proxy_cookie_path /bbs/ /I encountered another problem, that is, the session was lost after reverse generation.

Solution🎜Add proxy_cookie_path /bbs/ /;🎜
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template