2

I'm trying to use nginx as a load balancer, and it's working great. One problem, though.

The load balancing box is at 123.123.123.123, and the backend box is 456.456.456.456. So I have this config:

upstream backend {
    server 456.456.456.456;
}

server {
    listen       80;
    server_name  123.123.123.123;

    access_log  off;
    error_log off;

    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://backend;
    }
}

This works great. I hit 123.123.123.123 in my browser, and the page comes up. But now the URL in the browser says http://456.456.456.456.

Do I need to use a rewrite rule or something to keep the url correct? I don't want it to be different when going to different backed servers. None of the tutorials I've read have mentioned anything about this.

1 Answer 1

1

As it turns out, this was a situation where my app was set up to initially redirect, and that was causing the issue.

1
  • there is also proxy_redirect derective in nginx Jan 28, 2010 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .