From 43fca40ea34b564efcfb04fe1bef4c302efb6909 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Wed, 24 Feb 2021 23:01:14 +0100 Subject: [PATCH] nixos/nextcloud: update nginx config Please note that I didn't use the current nginx config from the administration manual as this would've broken ACME challenges[1]. Also added a fix for Microsoft clients. [1] https://github.com/nextcloud/documentation/pull/5825#issuecomment-783977761 (cherry picked from commit 797721423ca052dda400c0e1b1889c15f1972f29) --- nixos/modules/services/web-apps/nextcloud.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix index c4adf82f0646..87be14e7c12e 100644 --- a/nixos/modules/services/web-apps/nextcloud.nix +++ b/nixos/modules/services/web-apps/nextcloud.nix @@ -605,6 +605,14 @@ in { access_log off; ''; }; + "= /" = { + priority = 100; + extraConfig = '' + if ( $http_user_agent ~ ^DavClnt ) { + return 302 /remote.php/webdav/$is_args$args; + } + ''; + }; "/" = { priority = 900; extraConfig = "rewrite ^ /index.php;"; @@ -623,6 +631,9 @@ in { location = /.well-known/caldav { return 301 /remote.php/dav; } + location ~ ^/\.well-known/(?!acme-challenge|pki-validation) { + return 301 /index.php$request_uri; + } try_files $uri $uri/ =404; ''; };