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.

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