I have a Apache web server set which listens on port 4000 and I want to use this (local) server as a kind of proxy.The idea is to redirect all the local outcomming HTTP traffic (port 80) to my server at 127.0.0.1:4000. Of course, the server must be able to send request on port 80.I tried to update iptables like this :iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:4000Obviously it does not work because the traffic from my server is also redirected to itself.The question is: how can I only authorize HTTP request from my server?Example:A request is sent to www.google.comThe request is redirected to my server (127.0.0.1:4000)The server receives the request, do some stuff, then sends a request to www.google.comI managed to do the first part (2.) but because of that my server cannot access www.google.com as it is also redirected to itself.
Redirect outcomming traffic to local server
iptables;webserver