Skip to content

Commit ff07c07

Browse files
committed
nixos/caddy: Fix default log file for http:// hostnames
Caddy hostnames can begin with http:// to disable automatic HTTPS. The default value for services.caddy.<host>.logFormat puts the hostname in the log filename, resulting in a broken path. Similarly, multiple space-separated host names would not work before. Since version 2.9.0 (commit 7c52e7a), caddy fails to start if it cannot open the log file. This caused NixOS test failures (e.g., nixosTests.dokuwiki).
1 parent c270cdc commit ff07c07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nixos/modules/services/web-servers/caddy/vhost-options.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ in
5858
logFormat = mkOption {
5959
type = types.lines;
6060
default = ''
61-
output file ${cfg.logDir}/access-${config.hostName}.log
61+
output file ${cfg.logDir}/access-${lib.replaceStrings [ "/" " " ] [ "_" "_" ] config.hostName}.log
6262
'';
6363
defaultText = ''
6464
output file ''${config.services.caddy.logDir}/access-''${hostName}.log

0 commit comments

Comments
 (0)