nginx-ingress controller wordpress big files upload issue

3/19/2019

This is an EKS cluster where I have one ELB proxying traffic to an Nginx controller into the cluster. The nginx-configuration ConfigMap is defined as follows:

kind: ConfigMap
apiVersion: v1
metadata:
  name: nginx-configuration
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
data:
  use-proxy-protocol: "false"
  use-forwarded-headers: "true"

My Ingress resource looks like this.

 apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      annotations:
        kubernetes.io/ingress.class: "nginx"
        ingress.kubernetes.io/ssl-redirect: "true"
        nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
        ingress.kubernetes.io/proxy-body-size: "50m"
        nginx.org/proxy-connect-timeout: "30s"
        nginx.org/proxy-read-timeout: "20s"
        nginx.org/client-max-body-size: "50m"
      name: wordpress
      namespace: test
    spec:
      rules:
        - host: test.mrcartr.nl
          http:
            paths:
              - backend:
                  serviceName:  wordpress-mrcartr
                  servicePort: 80
                path: /

With the above configuration, I am not being able to upload big files, even having the proper limits increased in the .htaccess (backend side). Actually, I already create a parallel environment to test it without Nginx ingress and it worked. I mean if I have my traffic being forward from the ELB to the Backend everything works just fine. For sure it is something related to the ingress controller configuration. However, I already tested a couple of different cofigurations and I didn't manage to make this work. The log in the ngnix-controller pod is always the same:

GET /wp-admin/admin-ajax.php?action=updraft_ajax&subaction=activejobs_list&nonce=7ddb774c57&downloaders= HTTP/1.1" 200 460 "https://test.mrcartr.nl/wp-admin/options-general.php?page=updraftplus&tab=backups" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"

I am not really experienced with NGINX any help with that will be welcome.

-- Adriano S. Fonseca
eks
kubernetes
nginx
nginx-ingress
wordpress

2 Answers

2/10/2020

Add the following annotation to your Ingres controller to increase the body size.

nginx.ingress.kubernetes.io/proxy-body-size: 128m
-- Don Peter C. Atunalu
Source: StackOverflow

3/20/2019

Apparently, the culprit is nginx.org/client-max-body-size: "50m"

If the size in a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client. Please be aware that browsers cannot correctly display this error. Setting size to 0 disables checking of client request body size - nginx.org/client-max-body-size: "0"

More details of using ConfigMap and Annotations are here

-- A_Suh
Source: StackOverflow