Score:0

Can a VPN service be used like a reverse VPN allowing inbound traffic for serving a website?

sy flag

I’ve done quite a bit of searching, and it seems this can be done, but the answers I seem to find are either vague or responses are something along the lines of “but why would you want to do that?”

I’m hoping someone can point me in the right direction to accomplish the following:

CURRENT SETUP

Visitor - > Cloudflare Proxy -> Web Server

Cloudflare DNS proxy sits in front of my web server on a Digital Ocean VPS. A visitor puts mydomain.com into a web browser and my website is displayed. If that visitor was to use SecurityTrails, etc. to look up who is hosting the website, it shows as Cloudflare.

GOAL

Visitor -> Cloudflare Proxy -> reverse VPN Tunnel (from VPN service) -> Web Server

If this cannot be accomplished with Cloudflare Proxy, then I would just use Cloudflare for DNS only.

I know a VPN service is easy for encrypting outgoing connections to websites, but what about inbound connections? Can a VPN service that allows port forwarding (ExpressVPN, PureVPN, PIA) be configured on a VPS as a public reverse VPN, so when visitors put mydomain.com into a web browser they can visit my website just as they would if the VPN tunnel was not there? Then, minus Cloudflare, if that visitor was to look up who is hosting the website, it would show the VPN’s name, as it would be their IP address.

Where do I start with this? What would this be called if I ultimately needed to hire someone to implement? Is there a guide somewhere that explains creating this type of VPN tunnel?

Thank you in advance for your help!

Nikita Kipriyanov avatar
za flag
Don't mix the way the tunnel is provisioned and the way the traffic is going inside. VPN tunnel, as any other tunnel, has no direction. Once connection is established, it is symmetric, packets flows freely in both directions.
djdomi avatar
za flag
Questions should demonstrate reasonable information technology management practices. Questions that relate to unsupported hardware or software platforms or unmaintained environments may not be suitable for Server Fault. And This what you like to do, is decently NOT a common practies
Michael Hampton avatar
cz flag
"Why would you want to do that" is indeed a fair question.
sy flag
I love that someone down votes something they clearly do not understand. This may not be common practice, but it is definitely something that is not new. I just needed more information on how they are doing it. Thank you @user9517 for providing a useful response.
Score:2
cn flag

What you want is called 'port forwarding' (or similar) by commercial VPN providers. What they do is put rules in their firewall that forward packets arriving on your assigned port to your internal VPN IP address.

You need to configure the Cloudflare Proxy to send connections to the external ip address and your assigned port on the VPN server you are connected to. For example if you are assigned port 14386 and connect to a VPN server with an external IP address of 192.0.2.22 you would configure the proxy to connect to

192.0.2.22:14386

Depending on the VPN service, you may get different external IP addresses whenever you connect to the VPN. You will need to detect this change and update the proxy information as required.

You will also likely get different internal IP addresses. You may need to take this into consideration in your firewall and service configurations.

sy flag
It sounds like as long as I go with one of the VPNs that offer port forwarding, this shouldn't be much more difficult to set up with OpenVPN than if I was using it for outbound access. As for the changing IP addresses, I found some scripts people are using to detect their current IP and automatically update NGINX configs, so that is probably something I will need to use here. Thank you for your response.
sy flag
What kind of increase in latency do you think this will cause?
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.