From d57bc292c30386c47f0e38ee70fc8a96a97583b7 Mon Sep 17 00:00:00 2001 From: Daniel Fernandes Martins Date: Thu, 24 Aug 2017 09:30:12 -0300 Subject: [PATCH] Add support for 'client_body_timeout' and 'client_header_timeout' --- controllers/nginx/pkg/config/config.go | 10 ++++++++++ controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl | 2 ++ 2 files changed, 12 insertions(+) diff --git a/controllers/nginx/pkg/config/config.go b/controllers/nginx/pkg/config/config.go index 8a8247e8a4..be30c7a3b8 100644 --- a/controllers/nginx/pkg/config/config.go +++ b/controllers/nginx/pkg/config/config.go @@ -102,10 +102,18 @@ 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"` + // Defines a timeout for reading client request header, in seconds + // http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_timeout + ClientHeaderTimeout int `json:"client-header-timeout,omitempty"` + // 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"` + // Defines a timeout for reading client request body, in seconds + // http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_timeout + ClientBodyTimeout int `json:"client-body-timeout,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"` @@ -333,7 +341,9 @@ func NewDefault() Configuration { cfg := Configuration{ AllowBackendServerHeader: false, ClientHeaderBufferSize: "1k", + ClientHeaderTimeout: 60, ClientBodyBufferSize: "8k", + ClientBodyTimeout: 60, EnableDynamicTLSRecords: true, EnableUnderscoresInHeaders: false, ErrorLogLevel: errorLevel, diff --git a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl index 6eb0344d16..f10f8bc9a6 100644 --- a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl +++ b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl @@ -62,8 +62,10 @@ http { keepalive_requests {{ $cfg.KeepAliveRequests }}; client_header_buffer_size {{ $cfg.ClientHeaderBufferSize }}; + client_header_timeout {{ $cfg.ClientHeaderTimeout }}s; large_client_header_buffers {{ $cfg.LargeClientHeaderBuffers }}; client_body_buffer_size {{ $cfg.ClientBodyBufferSize }}; + client_body_timeout {{ $cfg.ClientBodyTimeout }}s; http2_max_field_size {{ $cfg.HTTP2MaxFieldSize }}; http2_max_header_size {{ $cfg.HTTP2MaxHeaderSize }};