Question

nginx internal communication between DO apps

So I’m trying to use the Digital Ocean App Platform. I have a node app deployed with the following app.yaml config:

name: my-app

services:
- name: admin
  github:
    repo: my-repo/admin
    branch: main
    deploy_on_push: true
  build_command: npm run build
  run_command: npm run start
  internal_ports:
  - 3000

This app should now be served at /admin.

To achieve that I added a nginx deployment to proxy to the internal 3000 port:

server {
    listen 80;
    listen [::]:80;
    server_name xxx.ondigitalocean.app;

    location /admin/ {
        set $app1 http://admin:3000;
        proxy_pass $app1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

When accessing my deployed app at https://xxx.ondigitalocean.app/admin/ I’m seeing We encountered an error when trying to load your application and your page could not be served. Check the logs for your application in the App Platform dashboard.

Checking the logs reveals: *424 no resolver defined to resolve admin

I can’t find anything on how to debug internal routing of the app platform and it seems like it’s related to that so I highly appreciate every sort of hint on this!


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
March 6, 2023

Hi there,

I believe that there is no need to add an Nginx proxy for this. You can deploy multiple components under one App Platform and you can define the the route address for each component directly.

To define this you can adjust the ‘HTTP Request Route’ value for the specific component.

For more information on how to manage the services on your app platform you can take a look at the documentation here:

https://docs.digitalocean.com/products/app-platform/how-to/manage-services/

For the complete list of the available App Specs, you can reference the docs here:

https://docs.digitalocean.com/products/app-platform/reference/app-spec/

Also all service components in the same app can communicate over a local network using the component name as the address. Additionally services can be configured to be “internal services” by specifying “internal_ports” property in the app spec. Here is an example repository utilizing this feature. I agree the documentation for this feature is lacking, and we are working on enhancing it with more details and examples.

Let me know if you have any questions!

Best,

Bobby

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