Question

Keep route prefix when using route in App Platform

I have a spec app.yml that I use to setup a service and a frontend in the App platform (I trimmed down the yaml file):

name: airmeeple

static_sites:
- name: frontend
  source_dir: frontend
  routes:
  - path: /

services:
- name: backend
  source_dir: backend
  routes:
  - path: /api

When DO re-routes requests to the backend, it strips the prefix /api such that if the request service.com/api/user, the service will receive the request /user.

Is it possible to configure the reverse proxy such that the prefix is kept when rerouting the request, such that the service sees a request with the path /api/user?

Thanks in advance!


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.

Accepted Answer

@yehudi @mirkul This was added by DO, there is now a preserve_path_prefix when configuring a route that allows the prefix to be kept.

Did you ore anyone find out a way to perform this ?

I am facing the same issue and am unable to perform what I need to do without that feature.

Thanks in advance.

Same here. Please answer

Try DigitalOcean for free

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

Sign up

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.