Skip to content

Commit d7eb3f5

Browse files
authored
Merge pull request #150 from aledbf/custom-header-size
Add support for custom header sizes
2 parents 30a6229 + 87322b8 commit d7eb3f5

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

controllers/nginx/pkg/config/config.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ type Configuration struct {
8383
// By default this is enabled
8484
EnableDynamicTLSRecords bool `json:"enable-dynamic-tls-records"`
8585

86+
// ClientHeaderBufferSize allows to configure a custom buffer
87+
// size for reading client request header
88+
// http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_buffer_size
89+
ClientHeaderBufferSize string `json:"client-header-buffer-size"`
90+
8691
// EnableSPDY enables spdy and use ALPN and NPN to advertise the availability of the two protocols
8792
// https://blog.cloudflare.com/open-sourcing-our-nginx-http-2-spdy-code
8893
// By default this is enabled
@@ -128,6 +133,12 @@ type Configuration struct {
128133
// http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout
129134
KeepAlive int `json:"keep-alive,omitempty"`
130135

136+
// LargeClientHeaderBuffers Sets the maximum number and size of buffers used for reading
137+
// large client request header.
138+
// http://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers
139+
// Default: 4 8k
140+
LargeClientHeaderBuffers string `json:"large-client-header-buffers"`
141+
131142
// Maximum number of simultaneous connections that can be opened by each worker process
132143
// http://nginx.org/en/docs/ngx_core_module.html#worker_connections
133144
MaxWorkerConnections int `json:"max-worker-connections,omitempty"`
@@ -221,6 +232,7 @@ type Configuration struct {
221232
// NewDefault returns the default nginx configuration
222233
func NewDefault() Configuration {
223234
cfg := Configuration{
235+
ClientHeaderBufferSize: "1k",
224236
EnableDynamicTLSRecords: true,
225237
EnableSPDY: false,
226238
ErrorLogLevel: errorLevel,
@@ -229,6 +241,7 @@ func NewDefault() Configuration {
229241
HSTSMaxAge: hstsMaxAge,
230242
GzipTypes: gzipTypes,
231243
KeepAlive: 75,
244+
LargeClientHeaderBuffers: "4 8k",
232245
MaxWorkerConnections: 16384,
233246
MapHashBucketSize: 64,
234247
ProxyRealIPCIDR: defIPCIDR,

controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ http {
5454

5555
keepalive_timeout {{ $cfg.KeepAlive }}s;
5656

57+
client_header_buffer_size {{ $cfg.ClientHeaderBufferSize }};
58+
large_client_header_buffers {{ $cfg.LargeClientHeaderBuffers }};
59+
5760
types_hash_max_size 2048;
5861
server_names_hash_max_size {{ $cfg.ServerNameHashMaxSize }};
5962
server_names_hash_bucket_size {{ $cfg.ServerNameHashBucketSize }};

0 commit comments

Comments
 (0)