Report this

What is the reason for this report?

How to guard a website/app behind VPN network

Posted on June 6, 2022

Hi,

I’m developing a NextJS web app and I want to setup a dev env such that there’s always a up-to-date application reading from the github repo.

However, since it’s the dev branch, I want to it only be accessed if the request is ona VPN.

My plan

    1. Setup a VPN service in a droplet (solved, there’s tutorial)
    1. Deploy an app such that it’s only accessible when on that VPN (? not sure how to achieve this)

I imagine i can do some IP check in NextJS? but wondering if there’s more elegant solution like setup the firewall on 2)'s droplet (I guess I cannot just deploy it through the App product)

Wondering if anyone did similar and can offer some input. Thanks



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can use a mixture of VPN and Firewall configurations to restrict access to your DEV environment.

In the VPN setup, you can use the VPN server’s IP address to set rules in the Firewall configuration. For the firewall, you can block all incoming traffic except that coming from your VPN’s IP address. This way, your applications can only be accessed through the VPN.

You can check our Firewall documentation

https://www.digitalocean.com/docs/networking/firewalls/how-to/configure-rules/

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Dark mode is coming soon.