Question

How to specify the app spec ingress field for an nginx reverse proxy service component?

Goal

I need to direct all traffic through an Nginx service component for reverse proxying, routing, rate limiting, etc.

Problem

The app runs without error on my local dev environment via Docker-Compose.

I try to update my App Platform app’s app spec from the terminal via doctl apps update <app-id>, but I get back an error: 400 (request "2887fea5-dc3a-40d2-a370-83659aa5f651") errors validating app spec; first error in field "ingress.rules.rule.match.path.prefix": rule match path prefix "/" already in use by rule with component: "nginx".

What’s strange is that even if I comment out every ingress rule in the app spec, the error still occurs.

I’m not sure about how I’m messing up. Any help is appreciated.

Note: I already have a version of my app currently running on App Platform. I’m not sure if somehow an ingress rule in the currently-running app’s app spec is causing the error.

System architecture (App Platform instance)

  • Service component: Nginx container. (reverse proxy, routing, rate limiting, …)
    • The nginx service component will handle routing to the client service component, and the api service component.
  • Service component: Client container.
  • Service component: API container.

app.yml

ingress:
  rules:
    - match:
        path:
          prefix: /
      component:
        name: nginx
        preserve_path_prefix: true
    - match:
        path:
          prefix: /ws
      component:
        name: nginx
        preserve_path_prefix: true
    - match:
        path:
          prefix: /api
      component:
        name: nginx
        preserve_path_prefix: true
services:
  - name: nginx
    ...
  - name: client
    ...
  - name: api
    ...

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
January 23, 2025
Accepted Answer

Hi there,

If I understand this correctly, since your Nginx component is acting as the reverse proxy for all traffic, you only need one rule with the / prefix directed to Nginx and then Nginx will handle the rest.

Have you tried to remove any additional rules like /api and /ws since Nginx will handle the routing internally?

If you are still hitting the problem after the change, it might be worth reaching out to the DigitalOcean support team directly: https://do.co/support

- Bobby

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.