Is there Web cache proxy which connects as a network bridge so it intercepts GET requests from client and redirects them to other Web server? (Without having to configure clients to use the proxy)

  Client              _________________
        \            |                 |
Client--- Network--- |eth0  Proxy  eth1|--- Internet
        /            |_________________|       \
  Client                                        \____________
                                                | Web cache  |
                                                |____________|

Thanks.

link|improve this question

73% accept rate
feedback

2 Answers

up vote 2 down vote accepted

You try to setup transparent proxying to the "web cache" if you are using Linux you can do something like this:

On your "eth0 Proxy eth1" box:

$ iptables -t mangle -A PREROUTING -j ACCEPT -p tcp --dport 80 -s web-cache-box
$ iptables -t mangle -A PREROUTING -j MARK --set-mark 3 -p tcp --dport 80
$ ip rule add fwmark 3 table 2
$ ip route add default via web-cache-box dev eth1 table 2

Then on "Web cache" box:

$ iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

The example above use policy routing. We mark all packages with destination port 80 and not from the web-cache-box with "3", when it's time for a routing decision we have added a rule telling packages with mark "3" should go to table "2" and in table "2" we set a default gateway which is the "web-cache". When package comes to the "web-cache" the packet is redirected to the Squid/XX port and in my example 3128. All this without rewriting/NATing.

etc.

link|improve this answer
You forgot to mention that you obviously have to configure Squid so it can handle this kind of requests. – e-t172 Oct 1 '09 at 9:52
No need to mention as its obvious :-) – rkthkr Oct 1 '09 at 11:47
You can use ebtables to do this at layer 2, as well. – Evan Anderson Oct 1 '09 at 13:39
feedback

Squid can do it. By default it would proxy it to the actual web-server but you can always configure it to route things elsewhere.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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