[GH-ISSUE #1807] setup nginx not to crash if host in proxy pass not found #1337

Open
opened 2026-02-26 07:30:33 +03:00 by kerem · 12 comments
Owner

Originally created by @pecqueurS on GitHub (Jan 26, 2022).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1807

Is your feature request related to a problem? Please describe.
When the proxy_host is used to proxy a docker container and this container is shut down afterwards, if you restart nginx-proxy-manager, it generates an error because the domain no longer exists. Nginx-proxy-manager can no longer launch.

Describe the solution you'd like
Modify the proxy pass option in nginx
actual :
proxy_pass http://:/;
proposal :

No stop when error on config

https://stackoverflow.com/questions/32845674/setup-nginx-not-to-crash-if-host-in-upstream-is-not-found/32846603#32846603

https://stackoverflow.com/questions/35744650/docker-network-nginx-resolver/37656784#37656784

resolver 127.0.0.11 valid=30s ipv6=off;
set $upstream_pass http://:/;
proxy_pass $upstream_pass;

Describe alternatives you've considered
Easier access to proxy_host configuration when nginx-proxy-manager is off to remove non-working configuration

Additional context
error when nginx-proxy-manager is restarted :
host not found in upstream "bar:3000" in /data/nginx/proxy_host/1.conf

Originally created by @pecqueurS on GitHub (Jan 26, 2022). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1807 **Is your feature request related to a problem? Please describe.** When the proxy_host is used to proxy a docker container and this container is shut down afterwards, if you restart nginx-proxy-manager, it generates an error because the domain no longer exists. Nginx-proxy-manager can no longer launch. **Describe the solution you'd like** Modify the proxy pass option in nginx actual : proxy_pass http://<domain>:<port>/; proposal : # No stop when error on config # https://stackoverflow.com/questions/32845674/setup-nginx-not-to-crash-if-host-in-upstream-is-not-found/32846603#32846603 # https://stackoverflow.com/questions/35744650/docker-network-nginx-resolver/37656784#37656784 resolver 127.0.0.11 valid=30s ipv6=off; set $upstream_pass http://<domain>:<port>/; proxy_pass $upstream_pass; **Describe alternatives you've considered** Easier access to proxy_host configuration when nginx-proxy-manager is off to remove non-working configuration **Additional context** error when nginx-proxy-manager is restarted : host not found in upstream "bar:3000" in /data/nginx/proxy_host/1.conf
Author
Owner

@kabadisha commented on GitHub (Mar 19, 2023):

I also had this problem. I've raised a PR which I believe fixes the issue:
https://github.com/NginxProxyManager/nginx-proxy-manager/pull/2672
If you can test my fix, that would be really helpful.

<!-- gh-comment-id:1475381035 --> @kabadisha commented on GitHub (Mar 19, 2023): I also had this problem. I've raised a PR which I believe fixes the issue: https://github.com/NginxProxyManager/nginx-proxy-manager/pull/2672 If you can test my fix, that would be really helpful.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 25, 2024):

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

<!-- gh-comment-id:1962784589 --> @github-actions[bot] commented on GitHub (Feb 25, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@Scemist commented on GitHub (May 3, 2024):

Same problem here, it doesn't make sense to fail the Nginx server for one proxy pass, since you can use it as an proxy for multiples addresses. So if some of websites fails, all the others will too.

<!-- gh-comment-id:2093526235 --> @Scemist commented on GitHub (May 3, 2024): Same problem here, it doesn't make sense to fail the Nginx server for one proxy pass, since you can use it as an proxy for multiples addresses. So if some of websites fails, all the others will too.
Author
Owner

@Lavshyak commented on GitHub (Jun 8, 2024):

location /foo/ {
        resolver 127.0.0.11; #(in my case with docker)
        set $upstream_server someserver:80;
        proxy_pass http://$upstream_server/;
}

now nginx don't crashes when someserver:80 is down

Upd: but then nginx cut off the rest of the request uri. http://host/foo/bar becomes just http://someserver:80/. How to fix this?

<!-- gh-comment-id:2156181389 --> @Lavshyak commented on GitHub (Jun 8, 2024): ``` location /foo/ { resolver 127.0.0.11; #(in my case with docker) set $upstream_server someserver:80; proxy_pass http://$upstream_server/; } ``` now nginx don't crashes when someserver:80 is down Upd: but then nginx cut off the rest of the request uri. http://host/foo/bar becomes just http://someserver:80/. How to fix this?
Author
Owner

@tyyrok commented on GitHub (Jul 15, 2024):

location /foo/ {
        resolver 127.0.0.11; #(in my case with docker)
        set $upstream_server someserver:80;
        proxy_pass http://$upstream_server/;
}

now nginx don't crashes when someserver:80 is down

Upd: but then nginx cut off the rest of the request uri. http://host/foo/bar becomes just http://someserver:80/. How to fix this?

Hi. Look at this article:

https://dev.to/danielkun/nginx-everything-about-proxypass-2ona#let-nginx-start-even-when-not-all-upstream-hosts-are-available

<!-- gh-comment-id:2229193195 --> @tyyrok commented on GitHub (Jul 15, 2024): > ``` > location /foo/ { > resolver 127.0.0.11; #(in my case with docker) > set $upstream_server someserver:80; > proxy_pass http://$upstream_server/; > } > ``` > > now nginx don't crashes when someserver:80 is down > > Upd: but then nginx cut off the rest of the request uri. http://host/foo/bar becomes just http://someserver:80/. How to fix this? Hi. Look at this article: https://dev.to/danielkun/nginx-everything-about-proxypass-2ona#let-nginx-start-even-when-not-all-upstream-hosts-are-available
Author
Owner

@Lavshyak commented on GitHub (Aug 7, 2024):

nginx:mainline-alpine3.18-perl works well for me. I don't notice any failures

<!-- gh-comment-id:2273657502 --> @Lavshyak commented on GitHub (Aug 7, 2024): nginx:mainline-alpine3.18-perl works well for me. I don't notice any failures
Author
Owner

@ZandercraftGames commented on GitHub (Jan 7, 2025):

Also having the same issue here. Quite frustrating to get working.

<!-- gh-comment-id:2575797772 --> @ZandercraftGames commented on GitHub (Jan 7, 2025): Also having the same issue here. Quite frustrating to get working.
Author
Owner

@abstract-entity commented on GitHub (Mar 10, 2025):

got the same with latest nginx docker image

<!-- gh-comment-id:2711317796 --> @abstract-entity commented on GitHub (Mar 10, 2025): got the same with latest nginx docker image
Author
Owner

@Legendary4226 commented on GitHub (Aug 14, 2025):

In the same annoying situation, like I build a container for Docker and Podman. Depending on the network subnet and the container engine, I can't guess the resolver IP.
I'm just blocked because there is no options. Should be good to define the resolver directive with a default value (for example "host") that preserve the default behavior (auto resolve with /etc/resolv.conf) and also activate the other wanted behavior that is the main subject of this issue.

I will just switch from NGINX to anything else more flexible, like who likes to have nothing working because of a little bit of dust in some config file ?

<!-- gh-comment-id:3188908044 --> @Legendary4226 commented on GitHub (Aug 14, 2025): In the same annoying situation, like I build a container for Docker and Podman. Depending on the network subnet and the container engine, I can't guess the resolver IP. I'm just blocked because there is no options. Should be good to define the resolver directive with a default value (for example "host") that preserve the default behavior (auto resolve with /etc/resolv.conf) and also activate the other wanted behavior that is the main subject of this issue. I will just switch from NGINX to anything else more flexible, like who likes to have nothing working because of a little bit of dust in some config file ?
Author
Owner

@yn-alex commented on GitHub (Aug 29, 2025):

Man.. this is a super annoying and totally unnecessary “feature”.
If the backend is dead just let it be dead, and use that http 500 code to tell us.

What is the difference between not starting nginx because the backend is dead and killing it if the backend dies 1 second after nginx goes up?

You would not kill the proxy if the pleb backend is acting up, and nobody does it. But you don’t allow it to start because of the same issue. There is simply no practical and technical reason to not allow the process to start because of this.

We run nginx with over 50 custom locations across multiple services. And it simply won’t start if one is dead or missconfigured (like typing the wrong port there).

<!-- gh-comment-id:3238270662 --> @yn-alex commented on GitHub (Aug 29, 2025): Man.. this is a super annoying and totally unnecessary “feature”. If the backend is dead just let it be dead, and use that http 500 code to tell us. What is the difference between not starting nginx because the backend is dead and killing it if the backend dies 1 second after nginx goes up? You would not kill the proxy if the pleb backend is acting up, and nobody does it. But you don’t allow it to start because of the same issue. There is simply no practical and technical reason to not allow the process to start because of this. We run nginx with over 50 custom locations across multiple services. And it simply won’t start if one is dead or missconfigured (like typing the wrong port there).
Author
Owner

@Daredevll commented on GitHub (Oct 27, 2025):

Any info on that? I'm also curious as to why this happens and honestly seems like a bug to me. We've got multiple independent containerized services running and removing one without disabling the proxy pass in NPM renders NPM inoperable, in practice taking down our whole suite of services..

<!-- gh-comment-id:3451946835 --> @Daredevll commented on GitHub (Oct 27, 2025): Any info on that? I'm also curious as to why this happens and honestly seems like a bug to me. We've got multiple independent containerized services running and removing one without disabling the proxy pass in NPM renders NPM inoperable, in practice taking down our whole suite of services..
Author
Owner

@tjunussov commented on GitHub (Nov 19, 2025):

Stupid feature, sometimes one small host could be down,
and whole server if rebooted, nginx-proxy-manager wont start,
of course of nginx host check feature, maybe we could do something smart ? if nginx failing to start, we could start at least itself in safe mode ? so user could disable failty host

<!-- gh-comment-id:3552068116 --> @tjunussov commented on GitHub (Nov 19, 2025): Stupid feature, sometimes one small host could be down, and whole server if rebooted, nginx-proxy-manager wont start, of course of nginx host check feature, maybe we could do something smart ? if nginx failing to start, we could start at least itself in safe mode ? so user could disable failty host
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#1337
No description provided.