Question

Reverse proxy running on a droplet as a workaround for the lack of static IP's in the App Platform

Hi everyone,

The App Platform is working great, however a major drawback we’re seeing is that there is no option to give it a dedicated, static IP (or a range of IP’s). This means we cannot whitelist our applications running on the App Platform to access resources hosted elsewhere.

I’m certainly not the only one running into this problem, as there’s a suggestion with a bunch of upvotes already about this topic: https://ideas.digitalocean.com/digitalocean/p/app-platform-static-ip

However, until DigitalOcean provides this functionality, I was trying to use the following workaround. What if I spin up a Droplet with an NGINX running, which acts as a proxy to those external systems. So my App Platform apps will call this droplet, and the droplet will forward the request. Since we can give reserved IP’s to droplets, this should work; right?

My main question is now, has someone already tried this? I’ve been messing with NGINX configs for the better part of the day, and I’m yet to come up with a working solution. In my case I need to proxy to a MySQL and Postgres DB.

Can anyone a) confirm this should be working, and b) happen to have a working configuration for NGINX (or another proxy solution)?

Thanks!


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
October 11, 2022
Accepted Answer

Hi there,

The Nginx config should looks something like this:

stream {
  upstream db {
    server your_external_mysql_serivce:3306;
  }

  server {
    listen 3306;
    proxy_pass db;
  }
}

Note that the stream directive, would need to be outside the http directive in order for this to work.

Let me know how it goes and if you are getting any specific errors!

Best,

Bobby

While this approach works, there’s apparently still no way to add your APP in the same VPC as your droplet; so for this to work you need to allow ALL IPV4 connections to your droplet; which is far from ideal.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel