HTTP Error 431: 3 Ways to Fix Request Header Fields Too Large
The HTTP Error 431: Request Header Fields Too Large response status code indicates that the origin server refuses to fulfill users’ requests. This issue happens when HTTP headers are too large.
When facing this error message, consider checking the cookies, shortening the referrer URL, and optimizing code. This article will explain each method and share tips on preventing the HTTP error 431 from happening again.
Below is the summary of the error 431:
|Error code||HTTP error 431|
|Error variations||Request header fields too large|
This page isn’t working
|Error causes||Too many cookies|
The referrer URL is too long
The total size of request headers is too large
What Is the HTTP Error 431?
The error 431 is a client-side issue, meaning the problem does not come from the origin server. However, this HTTP response status code indicates that the server cannot process the client’s request. The error 431 specifically points out an issue with the request’s header fields.
Even though the HTTP protocol does not have a maximum amount of data in requests, some servers have a size limit for security reasons.
Your web browser will show a message when the request headers or a single header field is too large.
The 431: Request header fields too large response status code might look different depending on your browser. However, most will not show an explanation of what causes this issue.
3 Methods to Fix the HTTP Error 431
We will share three methods to fix the HTTP 431: Request header fields too large response status code. Users can fix this error without accessing the server as this is a client-side issue.
Additionally, we’ll go over the troubleshooting steps for website owners who can access the server.
Check whether the website is down for everyone or only for you before following these methods.
1. Clear Your Cookies
However, clearing the browser cookies helps fix this issue.
Most web browsers have their own steps to clear browser cookies. You can also clear cookies for a particular website or all visited websites.
Clearing the cookies will log you out of previously-visited websites. Thus, we recommend saving your login information before following this method.
For example, here are the steps to clear cookies for Google Chrome users:
- Click on the three dots menu to the right of the address bar and select More tools -> Clear browsing data. Google Chrome will direct you to the Settings page. Another option is to enter Ctrl + Shift + Del on your keyboard.
- Under Clear browsing data, select the Time range to clear the cookies. We recommend choosing All time to clear them completely. Then, tick on the box next to Cookies and other site data.
If you do not want to lose your login information on all websites, follow these steps to clear cookies on a specific web address:
- Click on the three dots menu and select Settings -> Privacy and security.
- Select Cookies and other site data, scroll down, and click See all cookies and site data.
- Insert the site’s address on the Search cookies section.
- Click on the trash icon next to the address or the Remove All Shown button.
Clearing cookies regularly will help avoid this issue in the future. Furthermore, large amounts of cookies can also invite potential security threats.
2. Shorten the Referrer URL
When clicking on a link, the long referrer URL can cause the error 431. Shorten your query by removing everything after the question mark on your browser’s URL search. However, this is only a temporary solution for visitors.
If your site faces this issue, decrease the parameters to shorten your referrer URLs. Customize your query using the Campaign URL Builder with a Google Analytics account. The tool will also show which parameters are necessary or optional.
3. Go Through Your Code
If none of these methods work, look at your code. A lot of requests in the code cause this issue. In addition, some web servers have a size limit for request headers.
See if the request headers have exceeded the size limit. Some software will provide a tool to increase the request line limit, such as with Apigee. If you cannot increase it on your own, try contacting your hosting provider.
The HTTP 431: Request header fields too large response status code indicates an issue caused by the total size of the request’s headers. To answer any questions about the issue, we have shared the summary of its common causes, including too many cookies and long referrer URLs.
The three methods to fix error 431 include clearing the cookies, shortening the referrer query, and checking your code.
If you are still facing this issue, contact your hosting provider or refresh your browser if you are not the website owner.