REQUEST_HEADER_TOO_LARGE error occurs when the size of the request headers in Edge Functions and Edge Middleware exceeds the allowed limits. Specifically, individual request headers must not exceed 16 KB, and the combined size of all headers, including the header names, must not exceed 32 KB.
This issue often arises from excessively large headers in a request. On Vercel, applications may have custom headers, which, if overly large, can trigger this error during server request processing.
To troubleshoot this error, follow these steps:
- Limit header size: Ensure that the size of each request header does not exceed 16 KB
- Manage total header size: Monitor and control the combined size of all headers, keeping it under 32 KB
- Review cookies: Since cookies are included in the header, it's crucial to limit their size as part of the overall header size