Question

Help Needed: Nginx Reverse Proxy to Docker App on App Platform Results in 502 Error

I have a site with Nginx hosted on a Droplet, and I’m trying to create a reverse proxy for a subdirectory (/app) to another web application running on the App Platform in a Docker container. Unfortunately, I keep getting a 502 error no matter what I do. It’s possible to set up another site or domain, but not the one I want to run under the App Platform. Is there something I need to enable in the App Platform to allow a reverse proxy?


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.

This comment has been deleted

    alexdo
    Site Moderator
    Site Moderator badge
    May 31, 2024

    Heya,

    You can create a reverse proxy from Nginx to the URL generated from the App platform.

    A similar idea was shared before in the community before:

    https://www.digitalocean.com/community/questions/reverse-proxy-from-droplet-to-app-platform

    One other option here would be to just setup a redirect for domain.com/app) to go to a app.domain.com subdomain. That way you will not have to setup a proxy service to handle all requests, but you can just point the blog subdomain A record to the Droplet and then keep the main domain pointed to the App Platform.

    Regards

    To resolve the 502 error, ensure your Docker container’s app is accessible from the Droplet. Check firewall settings, ensure Nginx is correctly configured with the upstream server details, and verify that the App Platform’s app allows external connections. Also, confirm that Nginx’s proxy settings match the app’s requirements.

    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.