trailing slash in location
Igor Sysoev
igor at sysoev.ru
Sun Nov 18 15:09:22 UTC 2012
On Nov 18, 2012, at 17:25 , amodpandey wrote:
> Please help me understand
>
> The below works
>
> location /stats/ {
> proxy_pass http://example.com;
> }
>
> or
>
> location /stats {
> proxy_pass http://example.com;
> }
>
> or
>
> location /stats {
> proxy_pass http://example.com/stats;
> }
>
> or
>
> location /stats {
> proxy_pass http://example.com/stats/;
> }
>
> or
>
> location /stats/ {
> proxy_pass http://example.com/stats/;
> }
>
> But this does not work
>
> location /stats/ {
> proxy_pass http://example.com/stats;
> }
>
> Smlly when stats is an upstream
>
> This works
>
> location /stats {
> proxy_pass http://stats;
> }
>
> but this does not
>
> location /stats {
> proxy_pass http://stats/;
> }
It should work. Probably "/stats/" > "/stats" does not work.
> What difference it makes when we have uri in the proxy_pass?
It does not work because nginx changes /stats/SOME/PAGE to /statsSOME/PAGE.
Please read for details:
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
--
Igor Sysoev
http://nginx.com/support.html
More information about the nginx
mailing list