<div dir="ltr"><div><div><div><div><div><div><div>Hi Aleks,<br><br></div>I think it's not the one.<br></div>AFAIU the closest match for HAProxy "dst" is $server_addr, but it doesn't work as good with DNAT, because it hides original destination IP used by a client, even though there is a way to retrieve this information [1].<br></div><br></div>My usecase is following:<br><br></div>a) I create iptables rules on the host:<br> iptables -t nat -A OUTPUT -p tcp -d 192.168.170.1 --dport 7654 -j DNAT --to-destination <a href="http://127.0.0.1:11123">127.0.0.1:11123</a> <br> iptables -t nat -A OUTPUT -p tcp -d 192.168.170.2 --dport 7654 -j DNAT --to-destination <a href="http://127.0.0.1:11123">127.0.0.1:11123</a><br></div>b) Run load balancer on localhost port 11123<br></div><div>c) Use telnet to hit <a href="http://192.168.170.1:7654">192.168.170.1:7654</a> and <a href="http://192.168.170.2:7654">192.168.170.2:7654</a></div>d) I need load balancer to choose different upstreams depending on the address I specified on step (c)<br><div><div><div><div><div><div><br>It works with HAProxy, but unfortunately I can't find how to make it work with NGINX :(<br><br>WBR,<br>Alexey.<br><br>[1] <a href="https://github.com/haproxy/haproxy/blob/master/src/proto_tcp.c#L600">https://github.com/haproxy/haproxy/blob/master/src/proto_tcp.c#L600</a><br></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 30, 2016 at 3:50 AM, Aleksandar Lazic <span dir="ltr"><<a href="mailto:al-nginx@none.at" target="_blank">al-nginx@none.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi.<span class=""><br>
<br>
Am 30-03-2016 10:24, schrieb Alexey S:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
does nginx have a variable, that represents the destination IP address<br>
and port, like it was seen/used by the client at the connection time?<br>
</blockquote>
<br></span>
Could you mean<br>
<br>
<a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_addr" rel="noreferrer" target="_blank">http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_addr</a><br>
<br>
Cheers Aleks<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thank you.<br>
<br>
WBR,<br>
Alexey<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote>
</blockquote></div><br></div>