HTTP Error 431: How to Fix ‘Request Header Fields Too Large’ in 3 Steps

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 codeHTTP error 431
Error typeClient-side
Error variationsRequest header fields too large
This page isn’t working
Error causesToo 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.

Error 431 on the Chrome browser.

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

Too many cookies in the request can cause a web page to show the HTTP error 431 status instead of its content. Websites often use cookies to store preferences, give relevant content, and keep users signed in.

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:

  1. 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.
Google Chrome's clear browsing data option
  1. 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.
Clear browsing data window on Chrome, ticking the cookies and other site data option

If you do not want to lose your login information on all websites, follow these steps to clear cookies on a specific web address:

  1. Click on the three dots menu and select Settings -> Privacy and security.
Cookies and other site data section in Google Chrome's settings
  1. Select Cookies and other site data, scroll down, and click See all cookies and site data.
Google settings, showing the block third-party cookies in Incognito section
  1. Insert the site’s address on the Search cookies section.
Search cookies in Google Chrome
  1. Click on the trash icon next to the address or the Remove All Shown button.
Remove all shown cookies in Google Chrome

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.

Example of a referrer URL

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.

Hostinger web hosting banner

Conclusion

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.

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.

Author
The author

Astari S.

Astari is a digital marketing expert, with a focus on SEO and WordPress. She loves to share her wealth of knowledge through her writing, and enjoys surfing the internet for new information when she's not out in the waves or hiking a mountain. Her mission is to learn something new every day, and she firmly believes that there is no such thing as too much knowledge.