fix: avoid nginx error when webdav is missing

By default, nginx refuses to start if the upstream host is not found.
Since the webdav upstream server is optional here, we want nginx to
start even if the webdav upstream server is missing. The trick here is
to put the upstream url in a variable first so that nginx will not check
whether the upstream host exists on start and start anyway.
This commit is contained in:
Kingsley Yung 2024-10-04 12:20:37 +08:00 committed by Johannes Millan
parent 14b8d0fd64
commit 78c2649387

View file

@ -14,7 +14,11 @@ server {
return 302 /webdav/;
}
location /webdav/ {
proxy_pass $WEBDAV_BACKEND/;
set $upstream $WEBDAV_BACKEND;
# note: put the upstream host in a variable first so that nginx can
# starts successfully even if the upstream hsot is not found.
proxy_pass $upstream/;
# note: the trailing slash here matters!
}