Open matheusfenolio opened 2 years ago
Don't think this is an NPM issue, there is lots of talk of podman issues around DNS after the default network change that was done for Podman 4 which was released in May of this year. Seems although CNI was left as the network stack if network was already setup, the DNS plugin was no longer used by default so this is the symptom. Try adding the DNS plugin to Podman for the old CNI network you probably have or remove the exisiting old network and upgrade to the new default network type which does have DNS builtin.
I'll give it a shot! I saw some issues about it, but I thought it was fixed since I'm able to connect two containers only using the container name.
whats strange is DNS works properly from command line, and even for creating subfolder proxies but not hostname proxies. hostnames will intermittently resolve which has me scratching my head even more.
Even using CNI network backend DNS is still intermittent. cannot replicate the issue at command line
Sorry, I don't use podman or npm anymore, but there is a good reason why command line and nginx work differently. DNS for the command line is done via podman or whatever is setting up the container. Nginx is setup to use /data/nginx/resolv.conf. This from memory gets set at first start and perhaps is incorrect or has multiple servers in it, hence intermittent.
Well thanks for the reply anyway, you ultimately pointed me in the right direction. /data/nginx/resolv.conf no longer exist and didn't seem to have any affect on resolving this issue. However /etc/resolv.conf contained the podman host address and then my real host system dns entires. It appears that nginx was doing some sort of round robin selection of which DNS server it was going to use for lookup. Since this only affects host proxies and not subfolder location proxies I added a resolver entry to my host proxy custom config and that is working for me. I noticed the swag container uses 127.0.0.11 in it's resolver config which doesn't seem to work with this container. Maybe they are doing adding some sort of port forwarding or adding a package to make this work? Seems like that solution would work well for this container as well.
I believe I have tracked this down to a combination how nginx appears to handle the DNS resolution when it has multiple resolvers specified, and podman DNS resolution.
The issues can be resolved by manually altering the /etc/nginx/conf.d/include/resolvers.conf
to only include the podman resolver ip, and no other ips. In my case:
# from
resolver 10.89.0.1 8.8.8.8 ipv6=off valid=10s;
# to
resolver 10.89.0.1 ipv6=off valid=10s;
This resolved my issues, obviously this wont stick through a container restart right now due to how this file is generated so as a more resilient interim solution I've added the updated resolvers line to the custom configs for proxies https://nginxproxymanager.com/advanced-config/#custom-nginx-configurations. Ideally I'd put it into the custom http.conf
, however as nginx does not allow redeclaring directives, this wont work right now.
My proposal would be to allow a custom resolver config to be used on boot-up, and if it doesn't exist, then generate the file as it is right now.
Issue is now considered stale. If you want to keep it open, please comment :+1:
I believe I have this exact error running Portainer and using the hostname, the exact same as in the original description above.
Checklist
jc21/nginx-proxy-manager:latest
docker image?Describe the bug I'm trying to add a host using the name of the container, and when I open the URL, a 502 bad gateway appears. I tried using Docker, and it worked, but with Podman, it only works with container's IP.
Nginx Proxy Manager Version v2.9.18
To Reproduce Steps to reproduce the behavior:
Expected behavior The Nginx welcome page should appear
Screenshots
Operating System Tried on
Additional context docker-compose.yml version: '3' services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: