How to set up a proxy/router, so that some requests go to a slow VPN, and the rest goes to a fast local connection

networkingPROXYrouting

I have access to two gateways – one a slow VPN and the other a fast connection which blocks some hostnames (I'm behind the great firewall of china (gfw)).

I'd like to set up something (a tunnel / router / proxy) which would receive requests, and if they match one of the blocked hostnames, send them to the VPN, otherwise, send them to the fast local connection. I have Linux and Windows servers to use for this, and various routers (tomato).

The solution can be a router, or a program intercepting requests and redirecting them, or even something which just automatically creates route statements.

Having a VPN is really common here to route around the gfw, but it seems really inefficient to use it for everything. I'd also just appreciate pointers to the right terminology for what I'm looking for.

Best Answer

This is sort of problem cannot be solved on network layer for obvious reason. What you need in my opinion is to have two simple forwarding proxies. One fetching the pages over the wire other via VPN. In front of that setup you should put a Varnish instance. You can setup varnish to fallback to other backend if one fails, which is exactly what is needed in your configuration. Your clients should use Varnish as a proxy.

Such setup won't require any kind of list.