Skip to content

Commit

Permalink
nginx: don't configure ssl in tcpFastOpen when default404Server is di…
Browse files Browse the repository at this point in the history
…sabled
  • Loading branch information
SuperSandro2000 committed Dec 16, 2024
1 parent c95f124 commit 8b243b0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/nginx.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ in
};

acmeHost = lib.mkOption {
type = lib.types.str;
type = lib.types.nullOr lib.types.str;
default = null;
description = "The acme host to use for the default 404 server.";
};
};
Expand Down Expand Up @@ -188,14 +189,14 @@ in

default = lib.mkIf cfg.default404Server.enable true;
addSSL = lib.mkIf cfg.default404Server.enable true;
useACMEHost = lib.mkIf cfg.default404Server.enable cfg.default404Server.acmeHost;
useACMEHost = lib.mkIf (cfg.default404Server.enable && cfg.default404Server.acmeHost != null) cfg.default404Server.acmeHost;
locations = lib.mkIf cfg.default404Server.enable {
"/".return = 404;
};

listen = lib.mkIf cfg.tcpFastOpen (lib.mkDefault (lib.flatten (map (addr: [
{ inherit addr; port = 80; inherit extraParameters; }
{ inherit addr; port = 443; ssl = true; inherit extraParameters; }
({ inherit addr; port = 443; inherit extraParameters; } // lib.optionalAttrs (cfg.default404Server.acmeHost != null) { ssl = true; })
]) config.services.nginx.defaultListenAddresses)));

quic = lib.mkIf cfg.configureQuic true;
Expand Down

0 comments on commit 8b243b0

Please sign in to comment.