Question

How to Set up Private IP (VPC) connection for a Vue frontend droplet and a Django API backend with Nginx and SSL

Posted September 19, 2021 137 views
NginxDjangoVue.jsUbuntu 20.04DigitalOcean VPCDigitalOcean Droplets

Hi!

I have an issue leveraging the Private IP and VPC functionality between two droplets for a simple frontend and backend app.

  • I followed a tutorial to set up a Vue app on a droplet with Nginx and secure it with Let’s Encrypt.

  • Then I followed another tutorial to create a Django backend app on a droplet again with Nginx and Let’s Encrypt.

Both apps work flawlessly when accessing them separately.

I connected them, and the frontend reaches the backend api when using the backend droplet domain name or the public ip. Now I would like to secure the communication between the droplets by using the backend’s Private IP as the api url. Here, because the frontend uses ssl, a https:// address has to be provided, but when the https://internal_ip_of_backend is given, there is no response from the backend app. I also tried to create a self-signed certificate for the internal ip of the droplet using this tutorial: https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-in-ubuntu-18-04
but it still doesn’t work.

The two droplets are visible and can be reached by each other through the console, only the backend django app is not responding to the request from the front end app. Unfortunately I am quite new to nginx and it is probable that there is further configuration necessary. What am I missing?

I believe this is a very common scenario and I’ve been struggling to find a solution for this.

Any help is greatly appreciated!

Submit an answer

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