[GH-ISSUE #669] Resolver directive not working? #564

Closed
opened 2026-02-26 06:33:24 +03:00 by kerem · 6 comments
Owner

Originally created by @rlogiacco on GitHub (Oct 20, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/669

Checklist

What is troubling you?

I'm using proxy manager to proxy docker containers but when a container is restarted the proxy manager reports a 502 BAD GATEWAY.
I tried adding the resolver directive in the advanced configuration, like resolver 127.0.0.11 ipv6=off valid=30s; but it doesn't seem to work:
image

Do I need to use a variable for the resolve to work properly?

Originally created by @rlogiacco on GitHub (Oct 20, 2020). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/669 **Checklist** - [x] Please read the [setup instructions](https://nginxproxymanager.com/setup/) - [x] Please read the [FAQ](https://nginxproxymanager.com/faq/) **What is troubling you?** I'm using proxy manager to proxy docker containers but when a container is restarted the proxy manager reports a 502 BAD GATEWAY. I tried adding the `resolver` directive in the advanced configuration, like `resolver 127.0.0.11 ipv6=off valid=30s;` but it doesn't seem to work: ![image](https://user-images.githubusercontent.com/199473/96600141-eba76800-12f0-11eb-9b37-03c0bdbaa948.png) Do I need to use a variable for the resolve to work properly?
kerem 2026-02-26 06:33:24 +03:00
Author
Owner

@Elmardus commented on GitHub (Oct 21, 2020):

This may be related to the issue #633

<!-- gh-comment-id:713465521 --> @Elmardus commented on GitHub (Oct 21, 2020): This may be related to the issue #633
Author
Owner

@rlogiacco commented on GitHub (Oct 27, 2020):

I managed to have it working and it also solves #633 : you must use a variable and the resolver directive. The variable prevents the DNS resolution at boot from nginx, the resolver determines how frequently such variable is checked against the internal docket DNS.

<!-- gh-comment-id:716927553 --> @rlogiacco commented on GitHub (Oct 27, 2020): I managed to have it working and it also solves #633 : you must use a variable and the resolver directive. The variable prevents the DNS resolution at boot from nginx, the resolver determines how frequently such variable is checked against the internal docket DNS.
Author
Owner

@Wadera commented on GitHub (Oct 27, 2020):

I would suggest to show full resolution (for any other people who may face similar problem) and close Issue then ;)

<!-- gh-comment-id:717462475 --> @Wadera commented on GitHub (Oct 27, 2020): I would suggest to show full resolution (for any other people who may face similar problem) and close Issue then ;)
Author
Owner

@Elmardus commented on GitHub (Mar 3, 2021):

@rlogiacco How did you use the variable and the resolver directive?
I found this guide, but I have not figured out how to implement this in Nginx Proxy Manager.

<!-- gh-comment-id:789710975 --> @Elmardus commented on GitHub (Mar 3, 2021): @rlogiacco How did you use the variable and the resolver directive? I found [this guide](https://sandro-keil.de/blog/let-nginx-start-if-upstream-host-is-unavailable-or-down/), but I have not figured out how to implement this in Nginx Proxy Manager.
Author
Owner

@chaptergy commented on GitHub (May 12, 2021):

I'm pretty sure he means like this:

location / {
    resolver 127.0.0.11 valid=30s;
    set $custom_upstream example.com;
    proxy_pass http://$custom_upstream:80;
}

The $custom_upstream is the variable which will prevent DNS resolution at startup.

Which you can paste into your advanced tab.

<!-- gh-comment-id:840054181 --> @chaptergy commented on GitHub (May 12, 2021): I'm pretty sure he means like this: ```nginx location / { resolver 127.0.0.11 valid=30s; set $custom_upstream example.com; proxy_pass http://$custom_upstream:80; } ``` The `$custom_upstream` is the variable which will prevent DNS resolution at startup. Which you can paste into your advanced tab.
Author
Owner

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

For anyone who finds this in future:
This is a valid workaround for the problem where Nginx Proxy Manager fails to start if it can't resolve one of the upstream servers (e.g. another docker container on your unRaid server that is not currently started).

This issue only occurs with Proxy Hosts in NPM that have custom locations defined. The workaround is to remove the custom location declaration in the GUI and instead declare it manually in the 'Advanced' tab of the host like so:

location / {
    set $custom_upstream example.com;
    proxy_pass http://$custom_upstream:80;
}

Just replace example.com with the host that is not always available.

Note: I found that I found that I didn't have to set the resolver. I assume that Nginx is just using whatever its default values are.

<!-- gh-comment-id:1465052220 --> @kabadisha commented on GitHub (Mar 11, 2023): For anyone who finds this in future: This is a valid workaround for the problem where Nginx Proxy Manager fails to start if it can't resolve one of the upstream servers (e.g. another docker container on your unRaid server that is not currently started). This issue only occurs with Proxy Hosts in NPM that have custom locations defined. The workaround is to remove the custom location declaration in the GUI and instead declare it manually in the 'Advanced' tab of the host like so: ``` location / { set $custom_upstream example.com; proxy_pass http://$custom_upstream:80; } ``` Just replace `example.com` with the host that is not always available. **Note:** I found that I found that I didn't have to set the resolver. I assume that Nginx is just using whatever its default values are.
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#564
No description provided.