nginx ingress successfully applies ConfigMap file but it has no effect

12/21/2018

I'm trying to config my nginx-ingress with the following ConfigMap file:

apiVersion: v1
data:
  client-body-buffer-size: 32m
  client-max-body-size: 16m
  hsts: "true"
  proxy-body-size: 1g
  proxy-buffering: "false"
  proxy-read-timeout: "600"
  proxy-send-timeout: "600"
  server-tokens: "false"
  ssl-redirect: "false"
  upstream-keepalive-connections: "50"
  use-proxy-protocol: "true"
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","data":{"client-body-buffer-size":"32m","client-max-body-size":"16m","hsts":"true","proxy-body-size":"1g","proxy-buffering":"false","proxy-read-timeout":"600","proxy-send-timeout":"600","server-tokens":"false","ssl-redirect":"false","upstream-keepalive-connections":"50","use-proxy-protocol":"true"},"kind":"ConfigMap","metadata":{"annotations":{},"labels":{"app":"ingress-nginx"},"name":"nginx-configuration","namespace":"default"}}
  creationTimestamp: 2018-09-28T10:19:23Z
  labels:
    app: ingress-nginx
  name: nginx-configuration
  namespace: default
  resourceVersion: "65855983"
  selfLink: /api/v1/namespaces/default/configmaps/nginx-configuration
  uid: f88fe457-c307-11e8-b14b-42010a800076

But for some reason at least client-max-body-size config is not working - it sets to defalt 1m.

I can clearly see that new config was applied successfully in GCP, but it has no effect. What can be the reason it's not working?

-- stekatk
kubernetes
nginx
nginx-ingress

1 Answer

6/20/2019

It looks like you are using the wrong option name for client-max-body-size.

I think you are looking for proxy-body-size which the documentation says to refer to NGINX's client_max_body_size.

So what you want is something like this:

apiVersion: v1
data:
  client-body-buffer-size: 32m
  proxy-body-size: 16m
  ...
  ...
-- Chad
Source: StackOverflow