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