From edd87fbae3e542010d834dcd112264ac1c64b670 Mon Sep 17 00:00:00 2001 From: Shai Katz Date: Wed, 9 Jan 2019 16:41:58 +0200 Subject: [PATCH] add limit connection status code add default conn status code add missing colon add limit connection status code --- docs/user-guide/nginx-configuration/configmap.md | 5 +++++ internal/ingress/controller/config/config.go | 6 ++++++ rootfs/etc/nginx/template/nginx.tmpl | 1 + 3 files changed, 12 insertions(+) diff --git a/docs/user-guide/nginx-configuration/configmap.md b/docs/user-guide/nginx-configuration/configmap.md index 144885120..903928158 100644 --- a/docs/user-guide/nginx-configuration/configmap.md +++ b/docs/user-guide/nginx-configuration/configmap.md @@ -146,6 +146,7 @@ The following table shows a configuration option's name, type, and the default v |[http-redirect-code](#http-redirect-code)|int|308| |[proxy-buffering](#proxy-buffering)|string|"off"| |[limit-req-status-code](#limit-req-status-code)|int|503| +|[limit-conn-status-code](#limit-conn-status-code)|int|503| |[no-tls-redirect-locations](#no-tls-redirect-locations)|string|"/.well-known/acme-challenge"| |[no-auth-locations](#no-auth-locations)|string|"/.well-known/acme-challenge"| |[block-cidrs](#block-cidrs)|[]string|""| @@ -827,6 +828,10 @@ Enables or disables [buffering of responses from the proxied server](http://ngin Sets the [status code to return in response to rejected requests](http://nginx.org/en/docs/http/ngx_http_limit_req_module.html#limit_req_status). _**default:**_ 503 +## limit-conn-status-code + +Sets the [status code to return in response to rejected connections](http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html#limit_conn_status). _**default:**_ 503 + ## no-tls-redirect-locations A comma-separated list of locations on which http requests will never get redirected to their https counterpart. diff --git a/internal/ingress/controller/config/config.go b/internal/ingress/controller/config/config.go index 3dfdccddb..e938c008b 100644 --- a/internal/ingress/controller/config/config.go +++ b/internal/ingress/controller/config/config.go @@ -519,6 +519,11 @@ type Configuration struct { // Default: 503 LimitReqStatusCode int `json:"limit-req-status-code"` + // LimitConnStatusCode Sets the status code to return in response to rejected connections. + // http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html#limit_conn_status + // Default: 503 + LimitConnStatusCode int `json:"limit-conn-status-code"` + // EnableSyslog enables the configuration for remote logging in NGINX EnableSyslog bool `json:"enable-syslog"` // SyslogHost FQDN or IP address where the logs should be sent @@ -675,6 +680,7 @@ func NewDefault() Configuration { JaegerSamplerType: "const", JaegerSamplerParam: "1", LimitReqStatusCode: 503, + LimitConnStatusCode: 503, SyslogPort: 514, NoTLSRedirectLocations: "/.well-known/acme-challenge", NoAuthLocations: "/.well-known/acme-challenge", diff --git a/rootfs/etc/nginx/template/nginx.tmpl b/rootfs/etc/nginx/template/nginx.tmpl index 813cac3b0..381098dbe 100644 --- a/rootfs/etc/nginx/template/nginx.tmpl +++ b/rootfs/etc/nginx/template/nginx.tmpl @@ -198,6 +198,7 @@ http { ignore_invalid_headers {{ if $cfg.IgnoreInvalidHeaders }}on{{ else }}off{{ end }}; limit_req_status {{ $cfg.LimitReqStatusCode }}; + limit_conn_status {{ $cfg.LimitConnStatusCode }}; {{ if $cfg.EnableOpentracing }} opentracing on;