Pointing DNS record (A) to specific part of my Droplet

I’m running a simple backend using Python (flask) and I have set up an api which returns something on my droplet. I can access it by: http://<droplet-ip>/<app_route>. This works great but for the sake of not just giving out my server’s ip directly to everyone I wanted to add my domain to it. I have set my domain’s DNS records to DigitalOcean a while ago (over a month ago) and now I want to use it.

I created an A record with and pointed it to my droplet. How do I make it so routes to the previously mentioned http://<droplet-ip>/<app_route>?

Submit an answer
Answer a question...

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.

DigitalOcean Employee
DigitalOcean Employee badge
September 30, 2020
Accepted Answer


First off, grats on your app, droplet and domain :)

Secondly, after you create the DNS record and point it at your Droplet’s IP, you sometimes have to configure your web server software to handle “virtual hosts”.

Here’s an example with nginx: How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04

This might be helpful too, if you do not have nginx currently in use (or another web server like apache): How To Serve Flask Applications with Gunicorn and Nginx on Ubuntu 18.04

Hope this helps and good luck! Let us know if you have any more questions.