0

I have a server with multiple network interfaces, and I want to write a proxy server, which would listen on all of these IPs.

My config so far:

server {
    listen          111.111.111.111:40000;
    listen          111.111.111.222:40000;
    location / {
        resolver    8.8.8.8;
        proxy_bind  <listen interface here>;
        proxy_pass  http://$host;
    }
}

If I omit proxy_bind directive, Nginx sends request from the default IP, not the one I send request to.

Is it possible to fix this? If I could get the IP, request came to, it would solve my problem.

1 Answer 1

2

Have you tried to:

proxy_bind $server_addr;

I'm not 100% sure if that variable is available within a proxy configuration. But it should contain address of the specific connection.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.