Welcome! Log In Create A New Profile

Advanced

VirtualHost - Proxy Redirect Problem

November 24, 2010 10:24AM
Hello Experts,

I am trying to load balance a virtual domain with nginx listening in port 81. I am using 2 apache server;s as backends servers to distribute it.
The problem is when I request an url and nginx proxies it to the localhost server.
I changed the value on server_name_in_redirect to off, but I am still getting the false url, pointed to localhost/
One thing that it looks weird to me is that the request goes OK when nginx chooses to redirect to the 2nd server. The problem is only when redirects to 127.0.0.1:80.

This is my conf for the virtual domain:

[code]

upstream dom {
server 127.0.0.1:80 weight=2; # this doesn't work fine
server xx.xx.xx.xx:80 weight=8; # this shows me the correct url
}

server {
listen 81;
server_name virtualdomain.net;
server_name_in_redirect off; # added as a posible fix but did't work
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log logs/virtualdomain.log;

location / {

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_pass http://dom;
proxy_redirect off;

}
}

[/code]

Hope you can help me with this issue,

Many thanks!
Subject Author Posted

VirtualHost - Proxy Redirect Problem

juanginx November 24, 2010 10:24AM

Re: VirtualHost - Proxy Redirect Problem

juanginx November 24, 2010 10:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 309
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready