0

I have a local HTTP proxy running, if I configure my browser to go through it works perfectly but I would need to leave the browser configuration blank and only redirect the traffic to the proxy with iptables (or any other mechanism).

I tried these rules (separately) without succeeding (proxy returns 400 bad request error):

iptables -t nat -A OUTPUT -p tcp -o lo -d 127.0.0.1 --dport 80 -j DNAT --to 127.0.0.1:8082

iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8082

Is it even possible to use an HTTP proxy with only iptables ? Or does the HTTP request has to be rewritten as well ?

Thanks in advance for your help

0

This is called "transparent proxy". You need two things to do it:

  1. Your proxy server should support it (transparent proxy). Squid is a well-known proxy server which supports transparent proxy mode.
  2. Configure your firewall / router to redirect HTTP traffic to your proxy like the iptables rule you have.
  • Ok thanks for your answer, I don't think my proxy supports transparent mode (I am using a c++ library called fhscanhttplibrary). Therefore it's impossible to do that with a regular proxy I guess ? In the end I would like to have two proxies encapsulating the HTTP traffic inside a file for instance (client <-> client proxy <->server proxy <-> web server), but I'm not really sure how to make the proxy chaining. I tried to run two HTTP proxies but the second one refuses the connection from the first one. – Noxx Jul 5 '15 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.