add http/3 helper func
This commit is contained in:
parent
5752044098
commit
67421ab228
1 changed files with 15 additions and 1 deletions
16
ngx.ts
16
ngx.ts
|
|
@ -135,6 +135,20 @@ export const listen = (...extras: string[]) =>
|
|||
`http2 on`,
|
||||
]);
|
||||
|
||||
/**
|
||||
* create http/3 (quic) listen directives (+ supporting alt-svc header).
|
||||
*/
|
||||
export const http3 = (
|
||||
opts: {
|
||||
/** max age for alt-svc header */ ma?: number;
|
||||
} = {},
|
||||
) =>
|
||||
conform([
|
||||
"listen 443 quic reuseport",
|
||||
"listen [::]:443 quic reuseport",
|
||||
`add_header Alt-Svc 'h3=":443"; ma=${opts.ma ?? 86400}'`,
|
||||
]);
|
||||
|
||||
/**
|
||||
* create a server_name nginx directive.
|
||||
*
|
||||
|
|
@ -176,5 +190,5 @@ export const letsEncrypt = (
|
|||
*/
|
||||
export default Object.assign(
|
||||
(value?: string, children?: LooseConfigNode[]) => ngx(value, children),
|
||||
{ NGX_VERSION, listen, letsEncrypt, serverName },
|
||||
{ NGX_VERSION, listen, letsEncrypt, serverName, http3 },
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue