From b42c24f7f27a6a232f61a7c24afd7a7d00f21479 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Wed, 27 Feb 2019 22:14:35 +0100 Subject: [PATCH] nixos/nextcloud: add overwriteProtocol option The overwriteprotocol option can be used to force Nextcloud to generate URLs with the given protocol. This is useful for instances behind reverse proxies that serve Nextcloud with HTTPS. In this case Nextcloud can't determine the proper protocol and it needs to be configured manually. --- nixos/modules/services/web-apps/nextcloud.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix index 49d8836b8ad2..68b875333d6b 100644 --- a/nixos/modules/services/web-apps/nextcloud.nix +++ b/nixos/modules/services/web-apps/nextcloud.nix @@ -223,6 +223,19 @@ in { services.nextcloud.hostname here. ''; }; + + overwriteProtocol = mkOption { + type = types.nullOr (types.enum [ "http" "https" ]); + default = null; + example = "https"; + + description = '' + Force Nextcloud to always use HTTPS i.e. for link generation. Nextcloud + uses the currently used protocol by default, but when behind a reverse-proxy, + it may use http for everything although Nextcloud + may be served via HTTPS. + ''; + }; }; caching = { @@ -287,6 +300,7 @@ in { ${optionalString cfg.caching.apcu "'memcache.local' => '\\OC\\Memcache\\APCu',"} 'log_type' => 'syslog', 'log_level' => '${builtins.toString cfg.logLevel}', + ${optionalString (cfg.config.overwriteProtocol != null) "'overwriteprotocol' => '${cfg.config.overwriteProtocol}',"} ]; ''; occInstallCmd = let