mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 17:35:52 +03:00
[GH-ISSUE #3283] strange behaviour configuring proxy #2213
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#2213
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 @dogeMcdogeface on GitHub (Oct 25, 2023).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3283
Checklist
jc21/nginx-proxy-manager:latestdocker image?Describe the bug
On a fresh install, i added
host.docker.internalpointing to the host, since i need to reverse proxy an app which i do not have permission to dockerize running on port3000 of the host.I verified inside the container that the app is reachable using curl and indeed it is.
I used the webgui to configure a proxy to
host.docker.internal:3000on a certain subomain. This results in a 502 bad gateway when visiting the domain.I manually edited the 1.conf file and added
proxy_pass http://host.docker.internal:3000while commenting the other proxy.Visiting the domain now shows the application correctly.
Trying to figure out if i'd made a configuration error, i created an identical entry from the webgui with a different subdomain (without manually editing the config) and this time it worked with no issue.
Deleting the first proxy however, the second one stops working as well.
Nginx Proxy Manager Version
v2.10.4
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expected npm to serve
host.docker.internal:xwithout manual configurationScreenshots
(this did not work)


(This worked)
Operating System
Docker on Ubuntu 22.04.1 LTS
Additional context
added to docker-compose.yml
@bremme commented on GitHub (Jan 29, 2024):
Just came here to say I experience the same issue. I've added:
To my docker-compose.yaml file, curl
http://host.docker.internal:<my-port>does work, just not the proxy. As a workaround I changed host.docker.internal to 172.17.0.1 and this works as well. But I rather just use host.docker.internal to be 100% this points to the docker host.Let me know if you need more information to help solve this issue.
@MrLoading commented on GitHub (Jun 2, 2024):
same problem! (with Rocky OS 9.4 + docker 26.1.2 + nginx-proxy-manager:latest)
Below are the steps I've taken and the behaviors observed:
1. Direct Access Within the Container
Executing
curl http://host.docker.internal:3000from inside the container successfully returns a 200 status, indicating that the site is reachable and functions correctly.2. Proxy Configuration Issue
When configuring a proxy at
site.xxx.xxxusing the Nginx Proxy Manager GUI, attempting to curlsite.xxx.xxxfrom the host results in a "502 ERROR". The log from within the container shows the following error:3. Custom Nginx Configuration Solution
After configuring the "Custom Nginx Configuration" in the Nginx Proxy Manager GUI with the following setup, the issue resolves:
Configuration Comparisons (inside the container)
With Custom Nginx Configuration:
I'm seeking insights on why the default configuration results in a 502 error and how the custom configuration resolves this issue. Any guidance or suggestions would be greatly appreciated.
@MrLoading commented on GitHub (Jun 2, 2024):
After investigating, I believe the issue I encountered can be described as follows:
In Linux, when using --add-host=host.docker.internal:host-gateway or specifying extra_hosts: "host.docker.internal:host-gateway" in the compose.yaml, Docker writes the special hostname "host.docker.internal" into the container's /etc/hosts.
The DNS resolver within the NPM Docker container is set to 127.0.0.11, which can resolve container names normally, but does not resolve the special hostname "host.docker.internal".
The DNS resolver configuration in the NPM's nginx config file is as follows:
Nginx attempts to resolve all static addresses needed at startup or when refreshing its configuration (such as proxy_pass http://host.docker.internal:3000). Unfortunately, Nginx queries the resolver at runtime for addresses that use variables (such as proxy_pass $forward_scheme://$server:$port) and does not consider the contents of /etc/hosts.
Therefore, either Docker should provide a more robust implementation for "host.docker.internal," or the Docker version of NPM should specially treat this hostname to automatically convert it to a static address (like "172.17.0.1", which varies and requires checking with ip addr show).
For me, replacing "host.docker.internal" with "172.17.0.1" in the GUI configuration for the reverse proxy worked very well.
I am not a professional, so if any errors in my explanation or if anyone knows a better solution, please let me know.
@github-actions[bot] commented on GitHub (Jan 4, 2025):
Issue is now considered stale. If you want to keep it open, please comment 👍
@github-actions[bot] commented on GitHub (Jan 22, 2026):
Issue was closed due to inactivity.