feat(configmap): expose gzip-disable (#9505)

* docs(configmap): add link for gzip-min-length

* feat(configmap): expose gzip-disable

* test(e2e): cover gzip settings

* docs(configmap): simplify description with NGINX link

* refactor(configmap): simplify condition
This commit is contained in:
Samuel Vaillant 2023-01-17 02:08:32 +01:00 committed by GitHub
parent a069617ef8
commit e6dcd6845e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 115 additions and 1 deletions

View file

@ -438,6 +438,11 @@ type Configuration struct {
// Default: true
UseHTTP2 bool `json:"use-http2,omitempty"`
// Disables gzipping of responses for requests with "User-Agent" header fields matching any of
// the specified regular expressions.
// http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_disable
GzipDisable string `json:"gzip-disable,omitempty"`
// gzip Compression Level that will be used
GzipLevel int `json:"gzip-level,omitempty"`
@ -794,7 +799,6 @@ func NewDefault() Configuration {
defGlobalExternalAuth := GlobalExternalAuth{"", "", "", "", "", append(defResponseHeaders, ""), "", "", "", []string{}, map[string]string{}, false}
cfg := Configuration{
AllowSnippetAnnotations: true,
AllowBackendServerHeader: false,
AnnotationValueWordBlocklist: "",

View file

@ -64,6 +64,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
"access-log-path": "/var/log/test/access.log",
"error-log-path": "/var/log/test/error.log",
"use-gzip": "false",
"gzip-disable": "msie6",
"gzip-level": "9",
"gzip-min-length": "1024",
"gzip-types": "text/html",
@ -87,6 +88,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
def.ProxyReadTimeout = 1
def.ProxySendTimeout = 2
def.UseProxyProtocol = true
def.GzipDisable = "msie6"
def.GzipLevel = 9
def.GzipMinLength = 1024
def.GzipTypes = "text/html"