nginx: add vhost.http3

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Maciej Krüger 2021-04-18 18:53:21 +02:00
parent 4a3bb18683
commit 9530794548
No known key found for this signature in database
GPG Key ID: 0D948CE19CF49C5F
2 changed files with 22 additions and 1 deletions

@ -249,7 +249,15 @@ let
+ optionalString (ssl && vhost.http2) "http2 "
+ optionalString vhost.default "default_server "
+ optionalString (extraParameters != []) (concatStringsSep " " extraParameters)
+ ";";
+ ";"
+ (if ssl && vhost.http3 then ''
# UDP listener for **QUIC+HTTP/3
listen ${addr}:${toString port} http3 reuseport;
# Advertise that HTTP/3 is available
add_header Alt-Svc 'h3=":443"';
# Sent when QUIC was used
add_header QUIC-Status $quic;
'' else "");
redirectListen = filter (x: !x.ssl) defaultListen;

@ -151,6 +151,19 @@ with lib;
'';
};
http3 = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable HTTP 3.
This requires using <literal>pkgs.nginxQuic</literal> package
which can be achived by setting <literal>services.nginx.package = pkgs.nginxQuic;</literal>.
Note that HTTP 3 support is experimental and
*not* yet recommended for production.
Read more at https://quic.nginx.org/
'';
};
root = mkOption {
type = types.nullOr types.path;
default = null;