mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-28 19:05:51 +03:00
[GH-ISSUE #3050] Can not proxy to Docker Host network ports #2076
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#2076
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
My Config
I also used https mode but always 502 gate way

All other webserver inside dockers on npm-nw are working fine.
@duchu commented on GitHub (Jul 9, 2023):
I have same problem
@afzl-wtu commented on GitHub (Jul 10, 2023):
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.
@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.
@afzl-wtu commented on GitHub (Jul 10, 2023):
I create npm-nw network with command:
docker network create npm-nwIs 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.
@the1ts commented on GitHub (Jul 10, 2023):
You are creating a bridge network see
docker network create --help.@afzl-wtu commented on GitHub (Jul 11, 2023):
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.