nginx location 斜杠反向代理,不同配置后端接收地址不同

Posted mhi()

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

以上是关于nginx location 斜杠反向代理,不同配置后端接收地址不同的主要内容,如果未能解决你的问题,请参考以下文章