From 9099f3b4db44a4c26501d63b06f8ac26c1e250c9 Mon Sep 17 00:00:00 2001 From: Derek Perkins Date: Sun, 2 Sep 2018 23:53:30 -0600 Subject: [PATCH] add support for http2-max-requests in configmap --- docs/user-guide/nginx-configuration/configmap.md | 8 ++++++++ internal/ingress/controller/config/config.go | 7 +++++++ rootfs/etc/nginx/template/nginx.tmpl | 1 + 3 files changed, 16 insertions(+) diff --git a/docs/user-guide/nginx-configuration/configmap.md b/docs/user-guide/nginx-configuration/configmap.md index 77a6de1acf4..169f0df4fd3 100644 --- a/docs/user-guide/nginx-configuration/configmap.md +++ b/docs/user-guide/nginx-configuration/configmap.md @@ -48,6 +48,7 @@ The following table shows a configuration option's name, type, and the default v |[error-log-level](#error-log-level)|string|"notice"| |[http2-max-field-size](#http2-max-field-size)|string|"4k"| |[http2-max-header-size](#http2-max-header-size)|string|"16k"| +|[http2-max-requests](#http2-max-requests)|int|1000| |[hsts](#hsts)|bool|"true"| |[hsts-include-subdomains](#hsts-include-subdomains)|bool|"true"| |[hsts-max-age](#hsts-max-age)|string|"15724800"| @@ -267,6 +268,13 @@ Limits the maximum size of the entire request header list after HPACK decompress _References:_ [https://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_header_size](https://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_header_size) +## http2-max-requests + +Sets the maximum number of requests (including push requests) that can be served through one HTTP/2 connection, after which the next client request will lead to connection closing and the need of establishing a new connection. + +_References:_ +[http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_requests](http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_requests) + ## hsts Enables or disables the header HSTS in servers running SSL. diff --git a/internal/ingress/controller/config/config.go b/internal/ingress/controller/config/config.go index be74cb0446c..ee58f6d26c1 100644 --- a/internal/ingress/controller/config/config.go +++ b/internal/ingress/controller/config/config.go @@ -178,6 +178,12 @@ type Configuration struct { // HTTP2MaxHeaderSize Limits the maximum size of the entire request header list after HPACK decompression HTTP2MaxHeaderSize string `json:"http2-max-header-size,omitempty"` + // http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_requests + // HTTP2MaxRequests Sets the maximum number of requests (including push requests) that can be served + // through one HTTP/2 connection, after which the next client request will lead to connection closing + // and the need of establishing a new connection. + HTTP2MaxRequests int `json:"http2-max-requests,omitempty"` + // Enables or disables the header HSTS in servers running SSL HSTS bool `json:"hsts,omitempty"` @@ -562,6 +568,7 @@ func NewDefault() Configuration { GenerateRequestId: true, HTTP2MaxFieldSize: "4k", HTTP2MaxHeaderSize: "16k", + HTTP2MaxRequests: 1000, HTTPRedirectCode: 308, HSTS: true, HSTSIncludeSubdomains: true, diff --git a/rootfs/etc/nginx/template/nginx.tmpl b/rootfs/etc/nginx/template/nginx.tmpl index 25fc4fba1cf..79b5f24de81 100644 --- a/rootfs/etc/nginx/template/nginx.tmpl +++ b/rootfs/etc/nginx/template/nginx.tmpl @@ -155,6 +155,7 @@ http { http2_max_field_size {{ $cfg.HTTP2MaxFieldSize }}; http2_max_header_size {{ $cfg.HTTP2MaxHeaderSize }}; + http2_max_requests {{ $cfg.HTTP2MaxRequests }}; types_hash_max_size 2048; server_names_hash_max_size {{ $cfg.ServerNameHashMaxSize }};