mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
fix: crash when env var WEBDAV_BACKEND is not set
This commit is contained in:
parent
32aa4fb628
commit
7d5ccbd7ef
2 changed files with 11 additions and 7 deletions
|
|
@ -10,8 +10,6 @@ services:
|
|||
# (used with the WEBDAV_BACKEND environment variable)
|
||||
webdav:
|
||||
image: hacdias/webdav:latest
|
||||
ports:
|
||||
- 81:80
|
||||
volumes:
|
||||
- ./webdav.yaml:/config.yml:ro
|
||||
- ./data:/data
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
# Load environment variables
|
||||
map "" $webdav_backend {
|
||||
default "$WEBDAV_BACKEND";
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
|
@ -14,12 +19,13 @@ server {
|
|||
return 302 /webdav/;
|
||||
}
|
||||
location /webdav/ {
|
||||
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.
|
||||
if ($webdav_backend = "") {
|
||||
return 404;
|
||||
}
|
||||
|
||||
proxy_pass $upstream/;
|
||||
# note: the trailing slash here matters!
|
||||
resolver 127.0.0.11; # resolve webdav_backend by docker internal DNS
|
||||
rewrite ^/webdav/(.*)$ /$1 break; # remove the `/webdav/` prefix
|
||||
proxy_pass $webdav_backend;
|
||||
}
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue