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
I tried to update
iptables like this :
iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:4000
Obviously 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?
- A request is sent to www.google.com
- The request is redirected to my server (
- The server receives the request, do some stuff, then sends a request to www.google.com
I 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.