agentzh

2012/5/4 蒋子俊 <jzj....@gmail.com>:
> 在cluster_1后面加"/"  就好了。哪位大神解释一下是什么原理呢?:-)
>

在 ngx_proxy 模块的文档中已经解释过了:

"If it is necessary to transmit URI in the unprocessed form then
directive proxy_pass should be used without URI part:

    location  /some/path/ {
      proxy_pass   http://127.0.0.1;
    }
"

所以,当你不期望把当前 nginx 请求的 URI 转递给远方 http 服务的话,则需要自己加上 URI part,则那个尾随的 /
部分,否则当前请求的 URI 也会被代理到后面,即请求 http://127.0.0.1:10001/s1 这样的东西。

Best regards,
-agentzh

jzj.jackie

谢谢春哥。:-)

2012/5/4 agentzh <age...@gmail.com>
2012/5/4 蒋子俊 <jzj....@gmail.com>:
> 在cluster_1后面加"/"  就好了。哪位大神解释一下是什么原理呢?:-)
>

在 ngx_proxy 模块的文档中已经解释过了:

"If it is necessary to transmit URI in the unprocessed form then
directive proxy_pass should be used without URI part:

   location  /some/path/ {
     proxy_pass   http://127.0.0.1;
   }
"

所以,当你不期望把当前 nginx 请求的 URI 转递给远方 http 服务的话,则需要自己加上 URI part,则那个尾随的 /
部分,否则当前请求的 URI 也会被代理到后面,即请求 http://127.0.0.1:10001/s1 这样的东西。

Best regards,
-agentzh




--
Jackie