Merge pull request #5745 from MengqiWu/ingress
Add default-type as a configurable for default_type
This commit is contained in:
commit
687e433b94
4 changed files with 18 additions and 1 deletions
|
@ -183,6 +183,7 @@ The following table shows a configuration option's name, type, and the default v
|
||||||
|[block-user-agents](#block-user-agents)|[]string|""|
|
|[block-user-agents](#block-user-agents)|[]string|""|
|
||||||
|[block-referers](#block-referers)|[]string|""|
|
|[block-referers](#block-referers)|[]string|""|
|
||||||
|[proxy-ssl-location-only](#proxy-ssl-location-only)|bool|"false"|
|
|[proxy-ssl-location-only](#proxy-ssl-location-only)|bool|"false"|
|
||||||
|
|[default-type](#default-type)|string|"text/html"|
|
||||||
|
|
||||||
## add-headers
|
## add-headers
|
||||||
|
|
||||||
|
@ -1084,3 +1085,11 @@ _References:_
|
||||||
|
|
||||||
Set if proxy-ssl parameters should be applied only on locations and not on servers.
|
Set if proxy-ssl parameters should be applied only on locations and not on servers.
|
||||||
_**default:**_ is disabled
|
_**default:**_ is disabled
|
||||||
|
|
||||||
|
## default-type
|
||||||
|
|
||||||
|
Sets the default MIME type of a response.
|
||||||
|
_**default:**_ text/html
|
||||||
|
|
||||||
|
_References:_
|
||||||
|
[http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type](http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type)
|
||||||
|
|
|
@ -671,6 +671,11 @@ type Configuration struct {
|
||||||
// proxy-ssl-* annotations are applied on on location level only in the nginx.conf file
|
// proxy-ssl-* annotations are applied on on location level only in the nginx.conf file
|
||||||
// Default is that those are applied on server level, too
|
// Default is that those are applied on server level, too
|
||||||
ProxySSLLocationOnly bool `json:"proxy-ssl-location-only"`
|
ProxySSLLocationOnly bool `json:"proxy-ssl-location-only"`
|
||||||
|
|
||||||
|
// DefaultType Sets the default MIME type of a response.
|
||||||
|
// http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type
|
||||||
|
// Default: text/html
|
||||||
|
DefaultType string `json:"default-type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDefault returns the default nginx configuration
|
// NewDefault returns the default nginx configuration
|
||||||
|
@ -815,6 +820,7 @@ func NewDefault() Configuration {
|
||||||
NoAuthLocations: "/.well-known/acme-challenge",
|
NoAuthLocations: "/.well-known/acme-challenge",
|
||||||
GlobalExternalAuth: defGlobalExternalAuth,
|
GlobalExternalAuth: defGlobalExternalAuth,
|
||||||
ProxySSLLocationOnly: false,
|
ProxySSLLocationOnly: false,
|
||||||
|
DefaultType: "text/html",
|
||||||
}
|
}
|
||||||
|
|
||||||
if klog.V(5) {
|
if klog.V(5) {
|
||||||
|
|
|
@ -74,6 +74,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
|
||||||
"nginx-status-ipv6-whitelist": "::1,2001::/16",
|
"nginx-status-ipv6-whitelist": "::1,2001::/16",
|
||||||
"proxy-add-original-uri-header": "false",
|
"proxy-add-original-uri-header": "false",
|
||||||
"disable-ipv6-dns": "true",
|
"disable-ipv6-dns": "true",
|
||||||
|
"default-type": "text/plain",
|
||||||
}
|
}
|
||||||
def := config.NewDefault()
|
def := config.NewDefault()
|
||||||
def.CustomHTTPErrors = []int{300, 400}
|
def.CustomHTTPErrors = []int{300, 400}
|
||||||
|
@ -97,6 +98,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
|
||||||
def.ProxyAddOriginalURIHeader = false
|
def.ProxyAddOriginalURIHeader = false
|
||||||
def.LuaSharedDicts = defaultLuaSharedDicts
|
def.LuaSharedDicts = defaultLuaSharedDicts
|
||||||
def.DisableIpv6DNS = true
|
def.DisableIpv6DNS = true
|
||||||
|
def.DefaultType = "text/plain"
|
||||||
|
|
||||||
hash, err := hashstructure.Hash(def, &hashstructure.HashOptions{
|
hash, err := hashstructure.Hash(def, &hashstructure.HashOptions{
|
||||||
TagName: "json",
|
TagName: "json",
|
||||||
|
|
|
@ -279,7 +279,7 @@ http {
|
||||||
{{ buildOpentracing $cfg $servers }}
|
{{ buildOpentracing $cfg $servers }}
|
||||||
|
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type text/html;
|
default_type {{ $cfg.DefaultType }};
|
||||||
|
|
||||||
{{ if $cfg.EnableBrotli }}
|
{{ if $cfg.EnableBrotli }}
|
||||||
brotli on;
|
brotli on;
|
||||||
|
|
Loading…
Reference in a new issue