What component might emit 'Request max total header size exceeded'

I am posting documents into paperless-ngx via REST api. For some pdf documents the API reliably responds with

{"detail":"Multipart form parse error - Request max total header size exceeded."}

I checked one of the offending documents and found it to be a normal, valid PDF of about 180 kb size. There should not be too much fuss about it, yet I have that error.

Now I am wondering where this error might come from and how to get around it. Does it come from GUnicorn, Django or maybe the application itself?

As Vegard already commented, the error stems from Django's MultiPartParser when it detects the header is larger than the passed max parameter: https://github.com/django/django/blob/main/django/http/multipartparser.py#L693

The method is called with the max value in MAX_TOTAL_HEADER_SIZE https://github.com/django/django/blob/main/django/http/multipartparser.py#L754

But it also seems there is no easy way to configure a bigger value as it is hardcoded https://github.com/django/django/blob/main/django/http/multipartparser.py#L45

Back to Top