Merge pull request #1697 from aledbf/disable-features
Disable features not availables in some platforms
This commit is contained in:
commit
35363ff9f9
4 changed files with 22 additions and 11 deletions
|
@ -123,14 +123,23 @@ Example usage: `custom-http-errors: 404,415`
|
||||||
### Other Directives
|
### Other Directives
|
||||||
|
|
||||||
#### brotli-level
|
#### brotli-level
|
||||||
|
|
||||||
Sets the Brotli Compression Level that will be used.
|
Sets the Brotli Compression Level that will be used.
|
||||||
*Defaults to* 4
|
*Defaults to* 4
|
||||||
|
|
||||||
|
|
||||||
#### brotli-types
|
#### brotli-types
|
||||||
|
|
||||||
Sets the MIME Types that will be compressed on-the-fly by brotli.
|
Sets the MIME Types that will be compressed on-the-fly by brotli.
|
||||||
*Defaults to* `application/xml+rss application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component`
|
*Defaults to* `application/xml+rss application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component`
|
||||||
|
|
||||||
|
#### enable-brotli
|
||||||
|
|
||||||
|
Enables or disables compression of HTTP responses using the ["brotli" module](https://github.com/google/ngx_brotli).
|
||||||
|
|
||||||
|
The default mime type list to compress is: `application/xml+rss application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component`.
|
||||||
|
|
||||||
|
This is *enabled* by default
|
||||||
|
|
||||||
#### enable-modsecurity
|
#### enable-modsecurity
|
||||||
|
|
||||||
|
@ -332,14 +341,6 @@ Sets the number of unsuccessful attempts to communicate with the [server](http:/
|
||||||
|
|
||||||
Sets the time during which the specified number of unsuccessful attempts to communicate with the [server](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream) should happen to consider the server unavailable.
|
Sets the time during which the specified number of unsuccessful attempts to communicate with the [server](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream) should happen to consider the server unavailable.
|
||||||
|
|
||||||
#### use-brotli
|
|
||||||
|
|
||||||
Enables or disables compression of HTTP responses using the ["brotli" module](https://github.com/google/ngx_brotli).
|
|
||||||
|
|
||||||
The default mime type list to compress is: `application/xml+rss application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component`.
|
|
||||||
|
|
||||||
This is *enabled* by default
|
|
||||||
|
|
||||||
|
|
||||||
#### use-gzip
|
#### use-gzip
|
||||||
|
|
||||||
|
|
|
@ -335,7 +335,7 @@ type Configuration struct {
|
||||||
|
|
||||||
// Enables or disables the use of the NGINX Brotli Module for compression
|
// Enables or disables the use of the NGINX Brotli Module for compression
|
||||||
// https://github.com/google/ngx_brotli
|
// https://github.com/google/ngx_brotli
|
||||||
UseBrotli bool `json:"use-brotli,omitempty"`
|
EnableBrotli bool `json:"enable-brotli,omitempty"`
|
||||||
|
|
||||||
// Brotli Compression Level that will be used
|
// Brotli Compression Level that will be used
|
||||||
BrotliLevel int `json:"brotli-level,omitempty"`
|
BrotliLevel int `json:"brotli-level,omitempty"`
|
||||||
|
@ -476,7 +476,7 @@ func NewDefault() Configuration {
|
||||||
SSLSessionCacheSize: sslSessionCacheSize,
|
SSLSessionCacheSize: sslSessionCacheSize,
|
||||||
SSLSessionTickets: true,
|
SSLSessionTickets: true,
|
||||||
SSLSessionTimeout: sslSessionTimeout,
|
SSLSessionTimeout: sslSessionTimeout,
|
||||||
UseBrotli: true,
|
EnableBrotli: true,
|
||||||
UseGzip: true,
|
UseGzip: true,
|
||||||
WorkerProcesses: strconv.Itoa(runtime.NumCPU()),
|
WorkerProcesses: strconv.Itoa(runtime.NumCPU()),
|
||||||
WorkerShutdownTimeout: "10s",
|
WorkerShutdownTimeout: "10s",
|
||||||
|
|
|
@ -25,6 +25,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -598,6 +599,15 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
|
||||||
|
|
||||||
cfg.SSLDHParam = sslDHParam
|
cfg.SSLDHParam = sslDHParam
|
||||||
|
|
||||||
|
// disable features are not available in some platforms
|
||||||
|
switch runtime.GOARCH {
|
||||||
|
case "arm", "arm64", "ppc64le":
|
||||||
|
cfg.EnableModsecurity = false
|
||||||
|
case "s390x":
|
||||||
|
cfg.EnableModsecurity = false
|
||||||
|
cfg.EnableBrotli = false
|
||||||
|
}
|
||||||
|
|
||||||
tc := ngx_config.TemplateConfig{
|
tc := ngx_config.TemplateConfig{
|
||||||
ProxySetHeaders: setHeaders,
|
ProxySetHeaders: setHeaders,
|
||||||
AddHeaders: addHeaders,
|
AddHeaders: addHeaders,
|
||||||
|
|
|
@ -113,7 +113,7 @@ http {
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type text/html;
|
default_type text/html;
|
||||||
|
|
||||||
{{ if $cfg.UseBrotli }}
|
{{ if $cfg.EnableBrotli }}
|
||||||
brotli on;
|
brotli on;
|
||||||
brotli_comp_level {{ $cfg.BrotliLevel }};
|
brotli_comp_level {{ $cfg.BrotliLevel }};
|
||||||
brotli_types {{ $cfg.BrotliTypes }};
|
brotli_types {{ $cfg.BrotliTypes }};
|
||||||
|
|
Loading…
Reference in a new issue