Score:0

Selective routing through a VPN : route only certain websites using the domain name

de flag

tl;dr: Force or block traffic through VPN only for a few websites and only using the domain names.

Hi everyone,

I set up a VPN server using OpenVPN for a company I work with.

We'd like to hide our backoffice and administration platforms behind the VPN so that they can only be reachable by connected and allowed users.

I achieved this by setting up the VPN server on an EC2 and adding a WAF rule to the Cloudfront distribution to only allow traffic from the IP of the VPN server.

However this works by routing all traffic through the VPN, which isn't ideal since the bandwidth of the server is limited.

In an ideal world, we'd route only the traffic to our platforms through the VPN and let everything be routed to the internet.

In a less ideal world, we'd route everything through the VPN but allow the bandwidth-hungry platforms such as Spotify or YT to go through internet instead.

The problem is, routing is done at the IP level so we can't route traffic depending on the domain, and our platforms are behind Cloudfront distributions, so using the IPs is out of question.

Is there a way to separate the traffic like this ? Is there a way to allow users to be connected at all times to the VPN, but route traffic to the internet or the VPN when needed using the domain names ?

Michael Hampton avatar
cz flag
Routing is only done by IP address/subnet.
Patrick Mevzek avatar
cn flag
If the wish is only for websites, an HTTP proxy can help but then you need to make sure all clients use it (it can be by deploying a `proxy.pac` file). Then you "just" need to have that proxy behind the VPN (hence it has access to all websites there) but the proxy configuration in browsers will only pass the relevant websites to the proxy, all other will be DIRECT which means not through the VPN, if the client side of the VPN has no default route to it. You have drawbacks like burden of updating clients if you need to change list of websites.
Nikita Kipriyanov avatar
za flag
In addition to @PatrickMevzek: that also could be SOCKS proxy.
Seedy avatar
de flag
Thank you @PatrickMevzek, that is a good solution honestly. The team is small so updating clients won't be such a problem.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.