Welcome! Log In Create A New Profile

Advanced

PHP proxy/load balancing issue

Posted by Jbreck 
PHP proxy/load balancing issue
October 13, 2009 12:48PM
I have the following configuration for a basic load balancing setup:

http {
upstream backend {
ip_hash;
server 192.168.1.12:80;
}

server {
listen 80;
location / {
proxy_pass http://backend;
}

}
}

The problem I have, is although it proxies correcltly to the back server (just one as this is a test.) All the urls in the resulting page get rewritten to "http://backend", causing the page to render incorrectly. How do I prevent this?
Re: PHP proxy/load balancing issue
October 13, 2009 12:50PM
NM. My code is doing something is should not.
Re: PHP proxy/load balancing issue
October 13, 2009 12:55PM
Actually, it appears that it's passing "backend" as the SERVER_NAME from the browser. Any way to prevent this?
Re: PHP proxy/load balancing issue
October 18, 2009 09:44PM
I think you need to use:

proxy_set_header Host $host;

or you could put a string in there is you would like. That should set the host name for the request. This is set to "proxy_set_header Host $proxy_host;" by default. Can you look at what the host header is on the upstream server to confirm that it's set to "backend" instead of the host name?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready