0

I am trying to set up a connection between two servers so when one is accessed the client is proxied to the second one.

http {
    upstream serverConn {
            server <my.server.ip>;
    }

    server {
    listen 80 default_server;

    root /usr/share/nginx/html;

            location /test {
                    proxy_pass http://serverConn/;
                    proxy_set_header Host $upstream_addr;
                    proxy_set_header X-Forwarded-For $remote_addr;
                    proxy_set_header X-Forwarded-Host $http_host;
            }
    }

}

When a client accesses the server, it is supposed to proxy them to <my.server.ip>, but all of the get requests made on the webpage are looking for files on the server hosting nginx.

The URL that triggers the error

Here is a picture of the request made with the wrong ip, it should be <my.server.ip> instead of 10.XXX.XX.X which is the nginx server. Is there any solution to this? I tried many variations of set_header to no avail.

Lex Li
  • 1,414
Eaz3
  • 1

0 Answers0