NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
22.84k stars 2.65k forks source link

Does CNAME destinations work? #2368

Open pszypowicz opened 2 years ago

pszypowicz commented 2 years ago

Checklist

Describe the bug

I have 2 entries in my dns server: sub1.domain.com -> CNAME sub2.domain.com sub2.domain.com -> A record 192.168.0.2

I can get IP's of both from the shell of NPM container:

$ getent hosts sub2.domain.com
192.168.0.2 sub2.domain.com
$ getent hosts sub1.domain.com
192.168.0.2 sub2.domain.com sub1.domain.com

I'm configuring Proxy Host.

When I will configure destination to point to sub2.domain.com, everything works.

But when I'm using sub1.domain.com I see following error in the error_log:

sub1.domain.com could not be resolved (3: Host not found)

Nginx Proxy Manager Version

v2.9.18

To Reproduce Steps to reproduce the behavior:

  1. Configure the destination
  2. Visit site in broswer, get 502
  3. Check the error_log and see Host not found

Expected behavior

Site should work

Operating System

Synology docker

Additional context

DNS is handled with Adguard DNS rewrites

skirven4 commented 1 year ago

I have a CNAME set up, and it works fine. Do you have a valid entry in NPM that would resolve to your sub1.domain.com and would be accessible from the same location where you NPM is residing?

the1ts commented 1 year ago

What DNS server is in /data/nginx/resolvers.conf I think this is made at first start and if you have changed DNS servers since perhaps that needs updating. i.e. the NPM container and the Nginx may use different DNS servers for the lookup giving you the differing results you are seeing. The container (/etc/resolv.conf) probably uses 127.0.0.11 so points to the docker service which combines both docker hosted container names and forwards to the host to lookup requests external to docker.

pszypowicz commented 1 year ago

I found some time to reproduce the problem again and investigate it deeper.

I do not have /data/nginx/resolvers.con file, but I found that file in /etc/nginx/conf.d/include and it looks like this

[root@docker-7e906569418d:/etc/nginx/conf.d/include]# cat resolvers.conf
resolver 127.0.0.11  valid=10s;
[root@docker-7e906569418d:/etc/nginx/conf.d/include]# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0

So it looks like they both use the same dns server?

github-actions[bot] commented 9 months ago

Issue is now considered stale. If you want to keep it open, please comment :+1: