I am currently trying to make a nginx proxy work where it pass to different ips depending on the origin.
stream {
server {
listen 1000 udp;
proxy_pass 10.0.0.2;
allow 10.0.0.3;
}
server {
listen 1000 udp;
proxy_pass 10.0.0.3;
allow 10.0.0.2;
}
}
obviously this does not work as I can not listen on the same port twice. I tried something with "if" but it is not allowed there. Any ideas? I just want to proxy the traffic between the two ips.
2
Answers
You need transparent proxy or some kind of packet filter or firewall, not
nginx
, since it is reverse proxy and not suitable for your task.While I’m not sure you choose the right way to solve your task (unless you need some kind of load-balancing), however this this should be possible using several
upstream
blocks and thegeo
block:If you need a load-balancing, see the TCP and UDP Load Balancing article.