trailing slash at end URL with nginx as a reverse proxy for multiple website

Calin Don calin at presslabs.com
Sun Nov 20 19:06:49 UTC 2011


Remove the trailing / from proxy_pass directive.
On Nov 20, 2011 3:57 PM, "Nguyen Hai Nam" <nam.nh at nd24.net> wrote:

> Thank you guys for helping.
>
> I've tried following of Antonio, Edho and Igor's advices but no thing
> changes.
>
> @Igor: If I add proxy_redirect http://a.com:8001/ /; it will return
> error 404 Not Found.
>
> I'm curious in why when I type http://a.com/something it's redirected
> to http://a.com:8001/something, so  maybe it's wrong at reverse proxy
> point.
>
> Configuration of reverse proxy as seen:
>
> http {
>
> include /usr/nginx/conf/proxy.conf;
>
>    server {
>        listen       8080;
>        server_name  abc.com;
>
>  proxy_set_header   Host             $host;
>    proxy_set_header   X-Real-IP        $remote_addr;
>    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
>    proxy_max_temp_file_size 0;
> }
> }
>
> In proxy.conf
>
> server {
>    listen       80;
>    server_name  a.com;
>
>    access_log  on;
>    error_log on;
>
>    location / {
>        proxy_pass         http://10.2.176.21:8001/;
>        #proxy_redirect     off;
>        #server_name_in_redirect on;
>
>        proxy_set_header   Host             $host;
>        proxy_set_header   X-Real-IP        $remote_addr;
>        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
> }
> }
>
> Thanks for your help.
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20111120/c991ebf2/attachment.html>


More information about the nginx mailing list