Search code examples
apache2reverse-proxyiptablesproxmox

Reverse proxy & iptables


I've a kimsufi server and i've installed proxmox. I've created 2 containers :

1 reverse proxy (Apache2) 1 webserver (to create a wiki with apache2)

I want redirect all webtrafic (port 80) from host to reverse proxy because I want many containers with web server.

This is the network scheme :

Host : 192.168.254.254 Reverse proxy : 192.168.254.10 Wiki : 192.168.254.20

This is the iptables rules I have entering on host:

iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.254.10
iptables -t nat -A POSTROUTING -j MASQUERADE

But when I try a wget 192.168.1.20 on the reverse proxy, I have the index.html of the reverse proxy.

Thanks for your help


Solution

  • I've resolve my problem, I have to precise the out interface in the iptable rule, like that :

    iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to-destination 192.168.254.10:80