server { server_name drive.mydomain.com; listen 443 ssl; listen 8443 ssl; http2 on; access_log /var/log/nginx/drive.mydomain.com_access_log main; error_log /var/log/nginx/drive.mydomain.com_error_log info; # WebDAV requires basic auth, while normal auth can be used with FileBrowser include "com.mydomain/authelia_location.conf"; include "com.mydomain/authelia_location-basic.conf"; location / { include "com.mydomain/authelia_proxy.conf"; include "com.mydomain/authelia_authrequest.conf"; root /home/web/drive; } location = /common { return 301 https://$host/common/; } location /common/ { include "com.mydomain/authelia_proxy.conf"; include "com.mydomain/authelia_authrequest.conf"; client_max_body_size 512M; proxy_pass http://127.0.0.1:3002; proxy_set_header Connection $http_connection; proxy_set_header Connection 'upgrade'; proxy_cache_bypass $http_upgrade; } location /webdav/common { include "com.mydomain/authelia_proxy.conf"; include "com.mydomain/authelia_authrequest-basic.conf"; # https://mailman.nginx.org/pipermail/nginx/2007-January/000504.html - fix Destination: header # https://trac.nginx.org/nginx/ticket/348 - bug, workaround with named capture set $dest $http_destination; if ($http_destination ~ "^https://(?(.+))") { set $dest http://$myvar; } # Warning: adding / at the end of the proxy_pass will break WebDAV! proxy_pass http://127.0.0.1:10001; proxy_buffering off; gzip off; proxy_pass_request_headers on; proxy_set_header Destination $dest; } client_max_body_size 100M; }