Request Header or Cookie Too Large Error
This article addresses an error returned from Nginx that occurs when calling the /userinfo endpoint. The purpose is to explain the cause of the error and provide a solution. The error returned is:
Request Header or Cookie Too Large
- /userinfo Endpoint
- Request Headers
- Cookies
- Nginx
The error occurs because the size of the request header exceeds a fixed limit of 8kb on the reverse proxy software used for the APIs.
Several factors can contribute to an oversized request header:
- An Access Token contains too many scopes, which increases its size.
- The size of cookies included in the request header is too large.
- A custom domain with a reverse proxy is adding additional cookies to the request header.
- Some API clients automatically add cookies to request headers
The solution is to reduce the size of the request headers. This can be achieved by removing any unnecessary cookies and headers. Consider the following actions:
- Review and reduce the number of scopes requested for the Access Token.
- Remove any non-essential cookies being sent in the request header.
- If using a custom domain with a reverse proxy, review its configuration to prevent it from adding unnecessary cookies to the request.
