413 Request Entity Too Large in nginx k8s ingress
I wanted to enable a file upload. Whenever I was uploading I received the error code “413 Request Entity Too Large” from the nginx ingress controller in kubernetes. I found the solution here. Use the following annotation to allow unlimited upload size:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
---
apiVersion: networking.k8s.io/v1beta1 # for versions before 1.14 use extensions/v1beta1
kind: Ingress
metadata:
name: my-name
namespace: my-namespace
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/proxy-body-size: "0"
spec:
# The specs, omitted for readability