nginx redirecting to wrong port

Igor Sysoev is at rambler-co.ru
Tue May 27 12:57:25 MSD 2008


On Tue, May 27, 2008 at 10:55:23AM +0200, Dusan Turko wrote:

> > Could you show your proxied location ?
> <pre>
>    location / {
>             proxy_pass         http://localhost:8080/;
>             proxy_redirect     off;
>     port_in_redirect off;
>             proxy_set_header   Host             $host;
>             proxy_set_header   X-Real-IP        $remote_addr;
>             proxy_set_header   X-Forwarded-For 
> $proxy_add_x_forwarded_for;
> 
>             client_max_body_size       10m;
>             client_body_buffer_size    128k;
> 
>             proxy_connect_timeout      90;
>             proxy_send_timeout         90;
>             proxy_read_timeout         90;
> 
>             proxy_buffer_size          4k;
>             proxy_buffers              4 32k;
>       proxy_busy_buffers_size    64k;
>             proxy_temp_file_write_size 64k;
>     }
> </pre>
> 
> I use the same settings with apache2 on the other machine and there is 
> no problem. As I told, the problem occurs with apache1.3
> 
> If I type in a browser http://www.mysite.com/test/ is ok but when i type
> http://www.mysite.com/test then it redirect to
> http://www.mysite.com:8080/test/

This is because you set
           proxy_redirect     off;
and Apache 1.3 is configured to use www.mysite.com:8080 in redirects.

You may either fix Apache configuration or set in nginx:

-          proxy_redirect     off;
+          proxy_redirect     http://www.mysite.com:8080/  /;


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list