[GH-ISSUE #3050] Can not proxy to Docker Host network ports #2076

Closed
opened 2026-02-26 07:33:56 +03:00 by kerem · 6 comments
Owner

Originally created by @afzl-wtu on GitHub (Jul 9, 2023).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3050

I am runnign nginxproxymanger with following docker-compose.yaml file:
version: '3.8'
services:
app:
container_name: nginx
network_mode: npm-nw
ports:
- '80:80'
- '443:443'
extra_hosts:
- 'ss.ss:host-gateway'
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt

I added two extra settings here. network_mode: npm-nw for proxying to other dockers on this bridge network. And extra_hosts: - 'ss.ss:host-gateway', So that I can access and proxy to wireguard-ui web interface at port 5000 and adguard web interface at port 5001. I can proxy to all dockers on npm-nw network but I get "502 Bad Gateway" when proxying to ss.ss:5000 or ss.ss:5001 in npm.
I also added ports 5000 and 5001 in firewall setting. I also confirm I can send messages tcp and udp through netcat on host from inside the npm container (nc ss.ss 5000 ).
I also confirm, from inside npm container I successfully get webpage of wireguard-ui with wget ss.ss:5000 with no error.
So it confirms There is no firewall issue and also webpage of wireguard-ui or adguard can be accessed inside npm container with wget. Only NPM gives error of 502 bad gateway.
image
image

My Config

I also used https mode but always 502 gate way
image

All other webserver inside dockers on npm-nw are working fine.

Originally created by @afzl-wtu on GitHub (Jul 9, 2023). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3050 I am runnign nginxproxymanger with following docker-compose.yaml file: version: '3.8' services: app: container_name: nginx network_mode: npm-nw ports: - '80:80' - '443:443' extra_hosts: - 'ss.ss:host-gateway' image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt I added two extra settings here. network_mode: npm-nw for proxying to other dockers on this bridge network. And extra_hosts: - 'ss.ss:host-gateway', So that I can access and proxy to wireguard-ui web interface at port 5000 and adguard web interface at port 5001. I can proxy to all dockers on npm-nw network but I get "502 Bad Gateway" when proxying to ss.ss:5000 or ss.ss:5001 in npm. I also added ports 5000 and 5001 in firewall setting. I also confirm I can send messages tcp and udp through netcat on host from inside the npm container (nc ss.ss 5000 ). I also confirm, from inside npm container I successfully get webpage of wireguard-ui with wget ss.ss:5000 with no error. So it confirms There is no firewall issue and also webpage of wireguard-ui or adguard can be accessed inside npm container with wget. Only NPM gives error of 502 bad gateway. ![image](https://github.com/NginxProxyManager/nginx-proxy-manager/assets/64379149/9e03110b-5e9a-4bd8-b989-ceb3d56b3808) ![image](https://github.com/NginxProxyManager/nginx-proxy-manager/assets/64379149/e0f79116-8e83-4eac-9fe4-fb6ad7b08750) My Config I also used https mode but always 502 gate way ![image](https://github.com/NginxProxyManager/nginx-proxy-manager/assets/64379149/b6d28fe9-12cf-420d-ad8d-297cdd5bc42a) All other webserver inside dockers on npm-nw are working fine.
kerem 2026-02-26 07:33:56 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@duchu commented on GitHub (Jul 9, 2023):

I have same problem

<!-- gh-comment-id:1627704908 --> @duchu commented on GitHub (Jul 9, 2023): I have same problem
Author
Owner

@afzl-wtu commented on GitHub (Jul 10, 2023):

I have same problem

Update:
Strange, I just put docker gateway ip or my local ip of main host interface (10.0.0.x) and it connected successfully. I even removed extra_hosts parameter and also do not use any network: host in docker-compose and it still works. It means docker container can access my host network without any parameter. That is security Flaw.

version: '3.8'
services:
  app:
    container_name: nginx
    ports:
      - '80:80'
      - '443:443'
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    network_mode: npm-nw
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
<!-- gh-comment-id:1628378338 --> @afzl-wtu commented on GitHub (Jul 10, 2023): > I have same problem Update: Strange, I just put docker gateway ip or my local ip of main host interface (10.0.0.x) and it connected successfully. I even removed extra_hosts parameter and also do not use any network: host in docker-compose and it still works. It means docker container can access my host network without any parameter. That is security Flaw. ``` version: '3.8' services: app: container_name: nginx ports: - '80:80' - '443:443' image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped network_mode: npm-nw volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt ```
Author
Owner

@the1ts commented on GitHub (Jul 10, 2023):

I think perhaps some more understanding of docker networking would be useful, I liked this video discussion of all the types of networking, when to use them and what functionality is different between them all.
Saying a bridged network is insecure since it has access to both networks is not a security issue its the definition of a bridge in networking.

<!-- gh-comment-id:1628916873 --> @the1ts commented on GitHub (Jul 10, 2023): I think perhaps some more understanding of docker networking would be useful, I liked [this](https://www.youtube.com/watch?v=bKFMS5C4CG0) video discussion of all the types of networking, when to use them and what functionality is different between them all. Saying a bridged network is insecure since it has access to both networks is not a security issue its the definition of a bridge in networking.
Author
Owner

@afzl-wtu commented on GitHub (Jul 10, 2023):

I think perhaps some more understanding of docker networking would be useful, I liked this video discussion of all the types of networking, when to use them and what functionality is different between them all. Saying a bridged network is insecure since it has access to both networks is not a security issue its the definition of a bridge in networking.

I create npm-nw network with command:
docker network create npm-nw
Is it still a bridge network? If so, how I can make it not bridged but only dockers only network.
Also what is the solution of ss.ss not resolved to host ip address but 10.7.0.1xx works fine.

<!-- gh-comment-id:1629390688 --> @afzl-wtu commented on GitHub (Jul 10, 2023): > I think perhaps some more understanding of docker networking would be useful, I liked [this](https://www.youtube.com/watch?v=bKFMS5C4CG0) video discussion of all the types of networking, when to use them and what functionality is different between them all. Saying a bridged network is insecure since it has access to both networks is not a security issue its the definition of a bridge in networking. I create npm-nw network with command: `docker network create npm-nw` Is it still a bridge network? If so, how I can make it not bridged but only dockers only network. Also what is the solution of ss.ss not resolved to host ip address but 10.7.0.1xx works fine.
Author
Owner

@the1ts commented on GitHub (Jul 10, 2023):

You are creating a bridge network see docker network create --help.

<!-- gh-comment-id:1629648207 --> @the1ts commented on GitHub (Jul 10, 2023): You are creating a bridge network see `docker network create --help`.
Author
Owner

@afzl-wtu commented on GitHub (Jul 11, 2023):

You are creating a bridge network see docker network create --help.

Thanks for your time. I watched the whole video now. It is informative but I do not like the speaking person. Its way of speaking is not- much clear. But Thank u.

<!-- gh-comment-id:1629953883 --> @afzl-wtu commented on GitHub (Jul 11, 2023): > You are creating a bridge network see `docker network create --help`. Thanks for your time. I watched the whole video now. It is informative but I do not like the speaking person. Its way of speaking is not- much clear. But Thank u.
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#2076
No description provided.