[GH-ISSUE #5335] Parse /etc/hosts to allow using synonyms for IP addresses #3174

Open
opened 2026-02-26 07:38:02 +03:00 by kerem · 3 comments
Owner

Originally created by @adrifromhh on GitHub (Feb 21, 2026).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/5335

Is your feature request related to a problem? Please describe.
NPM seems to ignore the /etc/hosts file, so it's impossible to use a concise name for your proxy Hosts Forward Hostname / IP. That would be very helpful in a setup where the forward hosts are not docker containers, or on a different docker host.

Describe the solution you'd like
Please make NPM resolve addresses in the /etc/hosts file, so with the following addition to the Docker-Compose file, we could use synonyms for hosts IP addresses:

extra_hosts:
      - "host1:10.0.0.1"
      - "host2:10.0.0.2"

This adds hosts to the containers internal /etc/hosts file.

Best wishes
Adrian

Originally created by @adrifromhh on GitHub (Feb 21, 2026). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/5335 <!-- 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.* --> **Is your feature request related to a problem? Please describe.** NPM seems to ignore the `/etc/hosts` file, so it's impossible to use a concise name for your proxy Hosts `Forward Hostname / IP`. That would be very helpful in a setup where the forward hosts are not docker containers, or on a different docker host. **Describe the solution you'd like** Please make NPM resolve addresses in the /etc/hosts file, so with the following addition to the Docker-Compose file, we could use synonyms for hosts IP addresses: ``` extra_hosts: - "host1:10.0.0.1" - "host2:10.0.0.2" ``` This adds hosts to the containers internal `/etc/hosts` file. Best wishes Adrian
Author
Owner

@jc21 commented on GitHub (Feb 25, 2026):

In this project, Nginx is using a resolver directive which is generated on startup. It's usually something like this

resolver 127.0.0.11  valid=10s;

When doing this, Nginx ignores the hosts file for resolution.

From researching, I don't think there's any nginx-supported workaround for this. One possible option is to have the NPM project read from the hosts file on startup and create upstreams in nginx config, but that's a bit of a refactor.

<!-- gh-comment-id:3962450567 --> @jc21 commented on GitHub (Feb 25, 2026): In this project, Nginx is using a `resolver` directive which is generated on startup. It's usually something like this ``` resolver 127.0.0.11 valid=10s; ``` When doing this, Nginx ignores the `hosts` file for resolution. From researching, I don't think there's any nginx-supported workaround for this. One possible option is to have the NPM project read from the hosts file on startup and create upstreams in nginx config, but that's a bit of a refactor.
Author
Owner

@jc21 commented on GitHub (Feb 25, 2026):

I suppose another option is to disable the resolver generation with a env var. It might work for you

<!-- gh-comment-id:3962457929 --> @jc21 commented on GitHub (Feb 25, 2026): I suppose another option is to disable the resolver generation with a env var. It might work for you
Author
Owner

@jc21 commented on GitHub (Feb 25, 2026):

My commit message was Attempt to fix #5335 .. but github thought this means it's actually resolved.

If you'd like to test with the following image and env var:

services:
  npm:
    image: nginxproxymanager/nginx-proxy-manager-dev:develop
    environment:
      DISABLE_RESOLVER: true

let me know if that works for you

<!-- gh-comment-id:3962593380 --> @jc21 commented on GitHub (Feb 25, 2026): My commit message was `Attempt to fix #5335 ..` but github thought this means it's actually resolved. If you'd like to test with the following image and env var: ```yml services: npm: image: nginxproxymanager/nginx-proxy-manager-dev:develop environment: DISABLE_RESOLVER: true ``` let me know if that works for you
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#3174
No description provided.