[GH-ISSUE #4572] Unable to proxy requests using the container’s DNS name: 502 Bad Gateway #2920

Closed
opened 2026-02-26 07:37:12 +03:00 by kerem · 1 comment
Owner

Originally created by @gremo on GitHub (Jun 9, 2025).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/4572

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
    • Yes
  • Have you searched for similar issues (both open and closed)?
    • Yes

Describe the bug

I'm spending hours and days trying to figure out what's wrong with this setup. Based on my understanding of Docker, when creating an internal network, containers should be able to communicate using DNS names. And in fact, they do — from inside Nginx Proxy Manager I can reach the other container. But the proxy host keeps giving me a bad gateway. Proxy works only when using the container's IP address.

Tested with different containers: homeassistant, portainer, filebrowser, healthchecks. All works fine with Ip address.

  1. Create the internal network: docker network create internal --internal
  2. Spin a NPM container with the default bridge network
  3. Add the internal network: docker network connect internal nginx-proxy-manager
  4. Run a simple container like filebrowser with the internal network only (do not expose port, isolate it)
  5. Create a proxy host to filebrowser:80, that is using container DNS

Image

Container filebrowser networking (relevant part):

"NetworkSettings": {
    "Bridge": "",
    "Networks": {
        "internal": {
            "IPAddress": "172.19.0.4",
            "DNSNames": [
                "filebrowser",
                "d2099f13c0b0"
            ]
        }
    }
}

Container nginx-proxy-manager networking (relevant part):

"Networks": {
    "external": {
        "Gateway": "172.20.0.1",
        "IPAddress": "172.20.0.2",
        "DNSNames": [
            "nginx-proxy-manager",
            "603c8bc176a1"
        ]
    },
    "internal": {
        "IPAddress": "172.19.0.3",
        "DNSNames": [
            "nginx-proxy-manager",
            "603c8bc176a1"
        ]
    }
}

From inside the container curl -v http://filebrowser show the HTML page.

Nginx Proxy Manager Version
v2.12.3

Expected behavior
Should proxy requests using container’s DNS name.

Operating System
RaspberryPi 4B running Raspberry os-lite

Originally created by @gremo on GitHub (Jun 9, 2025). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/4572 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - Yes - Are you sure you're not using someone else's docker image? - Yes - Have you searched for similar issues (both open and closed)? - Yes **Describe the bug** I'm spending hours and days trying to figure out what's wrong with this setup. Based on my understanding of Docker, when creating an internal network, **containers should be able to communicate using DNS names**. And in fact, they do — from inside Nginx Proxy Manager I can reach the other container. But the proxy host keeps giving me a bad gateway. Proxy works only when using the container's IP address. Tested with different containers: homeassistant, portainer, filebrowser, healthchecks. All works fine with Ip address. 1. Create the internal network: `docker network create internal --internal` 2. Spin a NPM container with the default bridge network 3. Add the internal network: `docker network connect internal nginx-proxy-manager` 4. Run a simple container like filebrowser with the `internal` network only (do not expose port, isolate it) 5. Create a proxy host to `filebrowser:80`, that is using container DNS ![Image](https://github.com/user-attachments/assets/5043fabc-705c-4699-935c-694766fc1999) **Container filebrowser** networking (relevant part): ```json "NetworkSettings": { "Bridge": "", "Networks": { "internal": { "IPAddress": "172.19.0.4", "DNSNames": [ "filebrowser", "d2099f13c0b0" ] } } } ``` **Container nginx-proxy-manager** networking (relevant part): ```json "Networks": { "external": { "Gateway": "172.20.0.1", "IPAddress": "172.20.0.2", "DNSNames": [ "nginx-proxy-manager", "603c8bc176a1" ] }, "internal": { "IPAddress": "172.19.0.3", "DNSNames": [ "nginx-proxy-manager", "603c8bc176a1" ] } } ``` From inside the container `curl -v http://filebrowser` show the HTML page. **Nginx Proxy Manager Version** v2.12.3 **Expected behavior** Should proxy requests using container’s DNS name. **Operating System** RaspberryPi 4B running Raspberry os-lite
kerem 2026-02-26 07:37:12 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@gremo commented on GitHub (Jun 19, 2025):

Recreating everything from scratch solved the issue. Maybe something got corrupted — I’m not sure. For anyone facing the same problem: unfortunately, try deleting the data and reconfiguring your proxy hosts.

<!-- gh-comment-id:2988843756 --> @gremo commented on GitHub (Jun 19, 2025): Recreating everything from scratch solved the issue. Maybe something got corrupted — I’m not sure. For anyone facing the same problem: unfortunately, try deleting the data and reconfiguring your proxy hosts.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#2920
No description provided.