May 12, 2023
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.
Important! 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.
Warning! 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.
Install a plugin to make this process more manageable if you use WordPress. We recommend using Google Analytics Dashboard for WordPress or URL Params to shorten your parameters.
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.
Troubleshooting Other 4xx Errors
How to Solve HTTP Error 400
How to Fix 401 Unauthorized Error
How to Fix 403 Forbidden Error
How to Resolve 404 Not Found Error
How to Fix 413 Request Entity Too Large
Ways to Fix HTTP Error 431
HTTP Error 431 FAQs
Here are some more information about HTTP error 431.
What Causes an HTTP Error 431?
HTTP Error 431 occurs when the server receives a request header that is larger than the server is willing or able to process. This situation could happen due to a client sending too much data in the request header or a server with strict header size limits.
How Do I Prevent an HTTP Error 431?
Increasing the maximum header size your server can process will help to prevent HTTP Error 431, which can be done via your hosting. Configuring servers to compress and consolidate header fields and removing unnecessary cookies can also help prevent this error.
What Are the Consequences of an HTTP Error 431?
The consequences of HTTP Error 431 vary depending on the context of the request. In some cases, the error may cause the server to reject the request, leading to a failed transaction. In other cases, it may result in incomplete or corrupt data being processed.