Easily Fix Bad Request: Request Header or Cookie too Large Issue
If you are getting the Error 400 Bad Request: Request Header or Cookie too Large Issue issue while trying to access a website or even your own website, we are here to help you. In this article, we have compiled different solutions and workarounds that will help you completely rid yourself of this error.
Make sure to follow all the solutions that have been listed in this article and also read through the reasons due to which it occurs in the first place. Basically, some Nginx web servers are set up in such a way that they might not accept cookies that are greater than a certain size.
What Causes the 400 Bad Request Request Header or Cookie too Large Error?
After going through the mentioned solutions that the users have told us, we have concluded the reasons due to which the error might be triggered.
- Large Cookies: Sometimes, the cookies that you are trying to use with the website might be too large due to which the Bad Request Header or Cookie too large error might be triggered. Therefore, we suggest that you try and clear out the cookies in an attempt to fix the issue.
- DNS Cache: The DNS settings that you have configured with your computer might be preventing it from being able to connect with certain websites or the DNS cache stored might have been corrupted. Therefore, we suggest that you try and flush out the DNS cache.
- File Size: The File Size that you are trying to upload might be larger than the upload limit of the website. Therefore, we suggest that you try and reduce the file size or try to upload a different file with a size smaller than the one that you are trying to upload.
- Chrome Extensions: The extensions installed on your browser might be preventing the site from being accessed due to which the error is being triggered. Therefore, we suggest that you try and disable the extensions and then check to see if doing so fixes the error message.
Now that the reasons have been mentioned to you, you can finally start implementing the solutions and hopefully get rid of the error message on your PC.
Fixing the Bad Request Header or Cookie too Large Error:
Solution 1: Clear Cookies
This error can be instantly resolved by clearing cookies from your browser. Proceed with the steps listed below for clearing the cache in your respective browser:
- Launch Google Chrome and select the “Three Dots” on the top right side of the window.
- From the dropdown menu that appears, click on the “Settings” option.
- In the search bar type in “Site Settings” and open it.
- Navigate to “Content” and click on “Cookies and Site Data”.
- Afterwards, click on the “See all cookies and sites” option.
- Then click on “Remove All” to remove all of the cookies.
- Finally, proceed to “Restart” the Chrome browser.
- Open Firefox on your desktop PC and click on the “Open Application Menu” option in the top-right corner.
- From here select “Options” from the drop-down menu and next click on “Privacy & Security” from the right window pane.
- Next under the “History” section click on the “Clear History” option.
- Lastly “Restart” Firefox and check to see if the error got solved.
- Open Microsoft Edge on your PC and click on the “Three Dots” in the upper right corner of the window.
- Click on the “Settings” option on the top right side and from the left, select the “Privacy, Search, and Services” option.
- On the Right, select the “Choose what to clear” option and select it.
- Check the “Cookies and saved website data” option and next click on “Clear”.
- Lastly, “Restart” the browser and check to see if the error got fixed.
- Click on the “Opera” icon in the upper left corner of the window.
- Select the “Preferences” from the drop-down menu.
- Then select “Privacy and Security” and navigate to “Cookies”.
- Go to “All cookies and website data” and delete all cookies by clicking the “Delete All” option.
- Finally, “Restart” the browser.
- Click on the “Safari” icon on the top left-hand corner of the window.
- From the dropdown menu, navigate to “Preferences” and click on it.
- Select the “Privacy” tab and click on “Remove all website data” in cookies to delete all cookies.
- Then “Restart” your browser.
Solution 2: Add Base URL to Clear Cookies
- Open “Google Chrome” and click on three vertical dots on the top right corner of the window.
- A dropdown menu will appear up, from here click on “Settings”.
- In the search bar type “Site Settings” and click to open it.
- Click on the “Cookies and Site Data” option and scroll to the bottom.
- Click on “Add” which is next to the “Always Clear Cookies when Windows are Closed” option.
- Enter the base “Web Address”, e.g. youtube.com. (A base address is one that is without any path or an address that leads you to the front page of the website).
- Finally, click on “Add”.
Solution 3: Verify the Entered URL
Sometimes the URL you type is also wrong. A few common mistakes are misspelling the site name or entering the backward slashes. One easier way is to use the URL shortener if you have a long URL and try to copy-paste the URL instead of typing it manually to avoid any mistake. Once you have cross-checked your URL, try to access the page again. If you are still getting the error then try other methods like clearing cookies or disabling extensions.
Solution 4: Flush the DNS Cache
- Go to the “Start menu” and type “cmd” in the search bar. From the search results right-click on it and select “Run As Administrator”.
- Then type in the following command in the Command Prompt window and hit the “Enter” key:
- After executing this command now “Restart” your computer and run Steam again.
Solution 5: Compress the File Size
If you try to upload a file that is larger than the server limit, it is quite likely that you can face this error. You can check this by uploading a smaller file and if it uploads successfully then you might have to compress your file to avoid server limitation issues.
Solution 6: Wait Until the Server Is Being Fixed
This error can also occur due to server-side issues which are out of your control. It might be a server glitch or the server might be being updated. In such a scenario all you can do is to refresh the page and wait till servers are up again. Just refresh the page on a regular interval and check if the server has been fixed and the Header or Cookie too Large error is gone or not.
Solution 7: Disable Chrome Extensions
- Launch “Chrome” on your PC, and then click on the “Three vertical dots” in the top right of the window.
- From the drop-down menu click to select the “More Tools” option.
- Next click to select “Extensions” from the extended menu.
- Once inside the Extensions tab “Disable” all of the extensions one by one, if successful in removing the error you can try enabling the extensions one by one afterwards to find out the problematic one.
Solution 8: Change/Add the large_client_header_buffers 4 16k
- Add the “large_client_header_buffers 4 16k” directive to the “HTTP” section of “/etc/nginx.conf file”.
- Then reload the Nginx process by entering the following command:
sudo nginx -t && sudo service nginx reload
- If this doesn’t work then double the value of the second parameter of the “large_client_header_buffers” directive and reload Nginx.
- Check to see if doing so fixes the Header or Cookie too Large error.
Solution 9: Use Direct Connection Mode With TCP
Convert the application to use the “Direct connection mode” with the Transmission Control Protocol or TCP. After doing this the issue would not arise because this direct connection mode with the TCP does not have a header size restriction like the HTTP protocol. Use the latest version of SDK that has a fix for query operations when the service interop isn’t available. You can learn more about it in .NET v3 or .NET v2 performance tips articles.
If you can’t go for the direct connection with the TCP then change the client consistency level to lighten the problem. The session token is only used for session consistency, other consistency levels do not use the session token.
Implement the above-indexed methods carefully in order to avoid getting the Header or Cookie too Large error in the future but if you still have any more questions in this regard then feel free to Contact Us here.