Unable to upload files > 1mb in Rancher; Nginx returns 413 error code for file sizes >1mb. How to modify configuration to allow for larger uploads?

67 views Asked by At

I am not unable to upload files that are larger than 1mb. Nginx is responding with a 413 when the file size is greater than 1mb in Rancher.

I tried to locate the NGINX configuration in Rancher but I was unable to find it. I checked in the storage section in the Rancher namespace, where the configmaps were but I did not see a data section in that configmap where the nginx.conf would be

1

There are 1 answers

0
Adnan Adrika On

If you are using Rancher and you are experiencing an issue where you cannot upload files larger than 1MB, the solution is to increase the client-max-body-size annotation in the Rancher ingress controller.

To do this, follow these steps:

  • Go to the Ingress tab in the Rancher UI.
  • In the Namespace dropdown, select cattle-system.
  • Click on the name of the ingress controller.
  • In the Annotations section, click Add.
  • In the Key field, enter nginx.ingress.kubernetes.io/client-max-body-size.
  • In the Annotations section, click Add.
  • In the Key field, enter nginx.ingress.kubernetes.io/client-max-body-size.
  • In the Value field, enter a value greater than 1MB. For example, to set the limit to 10MB, enter 10M.
  • Click Save.

Once you have completed these steps, you should be able to upload files larger than 1MB.

Additional Information:

  • The client-max-body-size annotation sets the maximum size of the request body that the ingress controller will accept.
  • The default value for client-max-body-size is 1MB.
  • You can set client-max-body-size to 0 to disable the limit.

I hope this helps!