Add annotation to allow custom body sizes
This commit is contained in:
parent
22d74dfa41
commit
b0c2619594
6 changed files with 22 additions and 13 deletions
|
|
@ -179,7 +179,7 @@ Please check the [whitelist](examples/whitelist/README.md) example.
|
|||
|
||||
### **Allowed parameters in configuration ConfigMap**
|
||||
|
||||
**body-size:** Sets the maximum allowed size of the client request body. See NGINX [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size).
|
||||
**proxy-body-size:** Sets the maximum allowed size of the client request body. See NGINX [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size).
|
||||
|
||||
|
||||
**custom-http-errors:** Enables which HTTP codes should be passed for processing with the [error_page directive](http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page).
|
||||
|
|
|
|||
|
|
@ -78,10 +78,6 @@ var (
|
|||
type Configuration struct {
|
||||
defaults.Backend `json:",squash"`
|
||||
|
||||
// http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
|
||||
// Sets the maximum allowed size of the client request body
|
||||
BodySize string `json:"body-size,omitempty"`
|
||||
|
||||
// EnableDynamicTLSRecords enables dynamic TLS record sizes
|
||||
// https://blog.cloudflare.com/optimizing-tls-over-tcp-to-reduce-latency
|
||||
// By default this is enabled
|
||||
|
|
@ -225,7 +221,6 @@ type Configuration struct {
|
|||
// NewDefault returns the default nginx configuration
|
||||
func NewDefault() Configuration {
|
||||
cfg := Configuration{
|
||||
BodySize: bodySize,
|
||||
EnableDynamicTLSRecords: true,
|
||||
EnableSPDY: false,
|
||||
ErrorLogLevel: errorLevel,
|
||||
|
|
@ -253,6 +248,7 @@ func NewDefault() Configuration {
|
|||
VtsStatusZoneSize: "10m",
|
||||
UseHTTP2: true,
|
||||
Backend: defaults.Backend{
|
||||
ProxyBodySize: bodySize,
|
||||
ProxyConnectTimeout: 5,
|
||||
ProxyReadTimeout: 60,
|
||||
ProxySendTimeout: 60,
|
||||
|
|
|
|||
|
|
@ -70,9 +70,7 @@ http {
|
|||
gzip_proxied any;
|
||||
{{ end }}
|
||||
|
||||
server_tokens {{ if $cfg.ShowServerTokens }}on{{ else }}off{{ end }};
|
||||
|
||||
client_max_body_size "{{ $cfg.BodySize }}";
|
||||
server_tokens {{ if $cfg.ShowServerTokens }}on{{ else }}off{{ end }};
|
||||
|
||||
log_format upstreaminfo '{{ if $cfg.UseProxyProtocol }}$proxy_protocol_addr{{ else }}$remote_addr{{ end }} - '
|
||||
'[$proxy_add_x_forwarded_for] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" '
|
||||
|
|
@ -281,6 +279,8 @@ http {
|
|||
{{ template "CORS" }}
|
||||
{{ end }}
|
||||
|
||||
client_max_body_size "{{ $location.Proxy.BodySize }}";
|
||||
|
||||
proxy_set_header Host $host;
|
||||
|
||||
# Pass Real IP
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue