nginx location 斜杠反向代理,不同配置后端接收地址不同
请求的url
http://www.baidu.com/aa/bb/cc?id=1&name=zhangsan
第一种配置:
location /aa {
proxy_pass http://127.0.0.1:82;
proxy_set_header Host $host;
}
后端收到的url为:http:///www.baidu.com/aa/bb/cc?id=1&name=zhangsan
第二种配置:
location /aa/ {
proxy_pass http://127.0.0.1:82;
proxy_set_header Host $host;
}
后端收到的url为:http://www.baidu.com/aa/bb/cc?id=1&name=zhangsan
第三种配置:
location /aa {
proxy_pass http://127.0.0.1:82/;
proxy_set_header Host $host;
}
后端收到的url为:http://www.baidu.com//bb/cc?id=1&name=zhangsan
第四种配置:
location /aa/ {
proxy_pass http://127.0.0.1:82/;
proxy_set_header Host $host;
}
后端收到的url为:http://www.baidu.com/bb/cc?id=1&name=zhangsan
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
二维码