From 3bd2cb331f1a31321da90c369dfd5f0bd8cce53e Mon Sep 17 00:00:00 2001 From: Vlad Gorodetsky Date: Wed, 17 May 2017 09:23:18 +0300 Subject: [PATCH] Add keepalive_requests and client_boxy_buffer_size options --- controllers/nginx/pkg/config/config.go | 10 ++++++++++ controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/controllers/nginx/pkg/config/config.go b/controllers/nginx/pkg/config/config.go index 98017d32e..20169c602 100644 --- a/controllers/nginx/pkg/config/config.go +++ b/controllers/nginx/pkg/config/config.go @@ -92,6 +92,10 @@ type Configuration struct { // http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_buffer_size ClientHeaderBufferSize string `json:"client-header-buffer-size"` + // Sets buffer size for reading client request body + // http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size + ClientBodyBufferSize string `json:"client-body-buffer-size,omitempty"` + // DisableAccessLog disables the Access Log globally from NGINX ingress controller //http://nginx.org/en/docs/http/ngx_http_log_module.html DisableAccessLog bool `json:"disable-access-log,omitempty"` @@ -155,6 +159,10 @@ type Configuration struct { // http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout KeepAlive int `json:"keep-alive,omitempty"` + // Sets the maximum number of requests that can be served through one keep-alive connection. + // http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_requests + KeepAliveRequests int `json:"keep-alive-requests,omitempty"` + // LargeClientHeaderBuffers Sets the maximum number and size of buffers used for reading // large client request header. // http://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers @@ -273,6 +281,7 @@ type Configuration struct { func NewDefault() Configuration { cfg := Configuration{ ClientHeaderBufferSize: "1k", + ClientBodyBufferSize: "8k", EnableDynamicTLSRecords: true, EnableUnderscoresInHeaders: false, ErrorLogLevel: errorLevel, @@ -285,6 +294,7 @@ func NewDefault() Configuration { IgnoreInvalidHeaders: true, GzipTypes: gzipTypes, KeepAlive: 75, + KeepAliveRequests: 100, LargeClientHeaderBuffers: "4 8k", LogFormatStream: logFormatStream, LogFormatUpstream: logFormatUpstream, diff --git a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl index dd95f3a71..0ab70c0bb 100644 --- a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl +++ b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl @@ -56,10 +56,12 @@ http { reset_timedout_connection on; - keepalive_timeout {{ $cfg.KeepAlive }}s; + keepalive_timeout {{ $cfg.KeepAlive }}s; + keepalive_requests {{ $cfg.KeepAliveRequests }}; client_header_buffer_size {{ $cfg.ClientHeaderBufferSize }}; large_client_header_buffers {{ $cfg.LargeClientHeaderBuffers }}; + client_body_buffer_size {{ $cfg.ClientBodyBufferSize }}; http2_max_field_size {{ $cfg.HTTP2MaxFieldSize }}; http2_max_header_size {{ $cfg.HTTP2MaxHeaderSize }};