Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bad Request - Request Too Long HTTP Error 400. The size of the request headers is too long

Some of my users are getting the following error sometimes when they request some of the pages of my site: Bad Request - Request Too Long HTTP Error 400. The size of the request headers is too long

It seems to happen only in Firefox.

Deleting the users cookies does help.

What I don't understand is the following: I thought that cookies are appended to every request. Why is it that only one or two of my pages show this error and most do never?

It is also not dependent on the server page. If the user requests http://example.com/user/Myname he might get the error. If he just changes the capitalization of the URL it works again (like http://example.com/user/myname). (I am running IIS which does not care too much about capitalization).

For the browser the two URLs are different, for the server they aren't.

Any idea what is happening?

like image 938
Sparhawk Avatar asked Feb 08 '13 18:02

Sparhawk


People also ask

How do I fix HTTP error 400 a request header field is too long?

Chosen solutionClear the Cache and remove the Cookies for websites that cause problems via the "3-bar" Firefox menu button (Options/Preferences). If clearing cookies didn't help then it is possible that the cookies. sqlite file in the Firefox profile folder that stores the cookies got corrupted. rename/remove cookies.

How do I fix bad request request too long?

If you see the following error when trying to log into University Services with Google Chrome: Bad Request - Request Too Long HTTP Error 400 Try the following: Clear the browser cache completely. Clear the browser cookies. Restart the browser and try again.


2 Answers

It seems that there were too many cookies after all. I made sure that there were not so many and it is working now.

like image 131
Sparhawk Avatar answered Sep 19 '22 08:09

Sparhawk


Some of our users also ran into this same exception on IE 8 for some our our intranet sites hosted in IIS. The issue turned out to be related to using Kerberos authentication where a user belongs to many active directory groups.

We found solutions from the following Microsoft Support Articles:

  • HTTP 400 - Bad Request (Request Header too long)" error in Internet Information Services (IIS)
  • Problems with Kerberos authentication when a user belongs to many groups

The fix for us was to set the following registry keys with increased values and/or create them if they didn't exist:

  • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters\MaxFieldLength DWORD (32bit) - assigned value data 32000 (Decimal)
  • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters\MaxRequestBytes DWORD (32bit) - assigned value data 8777216 (Decimal)

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters] "MaxFieldLength"=dword:00007d00 "MaxRequestBytes"=dword:0085ee00

like image 24
mservidio Avatar answered Sep 18 '22 08:09

mservidio