Skip to content

Commit

Permalink
nixos/dokuwiki: Don't force http with Caddy
Browse files Browse the repository at this point in the history
Caddy usually expects just a hostname without scheme to do its automatic
HTTPS.  It is possible to get the old behavior (only HTTP) by setting
`services.caddy.virtualHosts.<host>.hostName`.
  • Loading branch information
lluchs committed Jul 16, 2024
1 parent 693bc46 commit fe8462a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nixos/modules/services/web-apps/dokuwiki.nix
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ in
services.caddy = {
enable = true;
virtualHosts = mapAttrs' (hostName: cfg: (
nameValuePair "http://${hostName}" {
nameValuePair hostName {
extraConfig = ''
root * ${pkg hostName cfg}/share/dokuwiki
file_server
Expand Down
5 changes: 5 additions & 0 deletions nixos/tests/dokuwiki.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ let
};
};

services.caddy.virtualHosts = {
"site1.local".hostName = "http://site1.local";
"site2.local".hostName = "http://site2.local";
};

networking.firewall.allowedTCPPorts = [ 80 ];
networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
};
Expand Down

0 comments on commit fe8462a

Please sign in to comment.