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

Nguyen Hai Nam nam.nh at nd24.net
Sun Nov 20 13:57:39 UTC 2011


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.



More information about the nginx mailing list