Question

Subdomain Redirects / Rewrites on the App Platform

I have a DO App with a custom domain:

The app has three components

  1. React frontend at my-app.com
  2. React content at my-app.com/docs
  3. NodeJs API at my-app.com/api

Is it possible to redirect/rewrite the last two components to a subdomain?

Is there a way to achieve this natively with die DigitalOcean App Platform?

Or is there any reasonable alternative? For example, adding a new component with an Nginx at my-app.com/ with a reverse proxy.

Any input and thoughts would be much appreciated.


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.

Greg M
DigitalOcean Employee
DigitalOcean Employee badge
June 21, 2023

You can partially do this with URL Redirects.

See: https://docs.digitalocean.com/products/app-platform/how-to/url-rewrites/#configure-a-redirect

The thing is, you need a route to be configured to a component (specifically for /docs and /api). App Platform doesn’t currently support domain only matching for components, so you’d either need to host those as separate apps with different domains OR redirect to docs.my-app.com/docs and api.my-app.com/api (or similar).

It doesn’t have to be as redundant, but multiple components under the same app can’t have the same route (“/”).

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