mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-26 09:55:51 +03:00
[PR #2672] FIX: Ngnix fails to start if custom location upstream is unavailable/unreachable #3607
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#3607
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/NginxProxyManager/nginx-proxy-manager/pull/2672
Author: @kabadisha
Created: 3/12/2023
Status: 🔄 Open
Base:
develop← Head:fix-startup-fail-when-upstream-is-down📝 Commits (6)
88e0295Add variables for scheme, host & porta0c945aAdd trailing whitespace58c42a6Add UI hintse9a6b7bMerge branch 'NginxProxyManager:develop' into fix-startup-fail-when-upstream-is-down214efcaFix proper handling of paths and parameterscf3a3bcImprove comments for clarity📊 Changes
2 files changed (+36 additions, -2 deletions)
View changed files
📝
backend/templates/_location.conf(+30 -2)📝
frontend/js/app/nginx/proxy/location-item.ejs(+6 -0)📄 Description
⚠️ Potentially breaking change:
Upstream services with special configurations to compensate for not being hosted at root of domain are affected (e.g. Sonarr & Radarr). See section A potential problem below for an explanation.
Issue:
Currently, if a Proxy Host has a custom location and the host being forwarded to is down, Nginx fails to start.
See here, here and here for examples of others who have encountered this issue.
Impact:
In this scenario:
Solution:
Declare a variable for
forward_hostinstead of simply injecting it directly into theproxy_passdirective.Although not strictly necessary to fix the issue, this PR also adds similar variables for
forward_schemeandforward_portas this keeps things consistent and these variables could be useful in any custom elements an end-user might want to add.Handling paths and GET params properly:
With further testing and reading I discovered that the Nginx
proxy_passdirective does not gracefully handle paths when using variables (source):I also found that @chaptergy had attempted something similar in the past, but reverted it because of this issue.
@chaptergy I believe the approach I have found works well. It certainly works in my testing. I'd appreciate your second opinion & testing though.
Testing:
It can be a bit tricky testing this because it isn't always obvious exactly what request is being passed to the upstream.
For my testing, I used http-https-echo as my upstream as it simply shows the details of the request being passed through directly in the browser. Super handy.
A potential problem:
For one of my proxy hosts, I had a custom location:
/sonarrwith the forward hostname set tosonarr.It turns out that prior to this change, the
proxy_passdirective was automatically including the custom location path/sonarrin the proxied request to the upstream Sonarr.This meant that in Sonarr's configuration, I had configured the property
URL Baseto/sonarrto compensate.With this PR, the
proxy_passdirective now actually does what the NPM UI describes and so uses the path specified by the user in theForward Hostname / IPfield instead. If no path is provided there, then no path is used in the upstream request.This means that with this change in place, I either have to set the
URL Baseproperty in Sonarr back to the default/or set theForward Hostname / IPfield in NPM tosonarr/sonarr.This also affects Radarr in the same way.
Conclusion:
Personally, I think this PR actually makes NPM behave in a way that is more flexible, explicit and in keeping with what the UI actually presents. However, I'm pretty sure that this makes it a potentially breaking change for many users who have 'worked around' this issue by configuring their upstream systems to recognise that they are not hosted at the root of the domain. It also needs some decent testing by the community.
On the flip side, this PR would:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.