Skip to content

Unable to proxy requests using the container’s DNS name: 502 Bad Gateway #4572

Open
@gremo

Description

@gremo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions