0

I am developing laravel website and I encounter this very stressfull error. Yesterday, my website is running smoothly until today. Today, after several times of form submit, It returns:

Bad Request

Your browser sent a request that this server could not understand. Size of a request header field exceeds server limit.

I noticed that there are lots of cookies generated from localhost (see image below):

Localhost Cookie

if I delete one of those cookie, I can open my website I have done several checks on javacript and all other code but couldn't find anything wrong.

What could possibly go wrong? is it on my code? or my web server? or anything?

  • Can you open Chrome Dev tools under Network when you submit your form. What is returned? Also please check laravel log file. You can also try Incognito mode see if this is still happening. – Silvanus Matiku Oct 07 '17 at 02:53
  • After further debugging, I found that this error is not triggered by form request. Everytime I open any page on my website after logged in, It generates new localhost cookie with very long and random cookie name (just like image above). Bad request happen after 4 page request. It doesn't supposed to happen. Laravel only generates 2 cookie: ls (laravel session) and XSRF-TOKEN. @SilvanusMatiku: It also happen on incognito. – Ivan Kurniawan Prasetyo Oct 07 '17 at 03:13
  • My problem is similar to: https://stackoverflow.com/questions/36342882/laravel-cookie-storage-gets-exceeded-after-every-few-visits But, I didn't installing new plugins. – Ivan Kurniawan Prasetyo Oct 07 '17 at 03:29

1 Answers1

1

It turns out that I accidentaly calls 'web' middleware twice.

enter image description here

Just delete one of them and its finally works perfectly.

  • This answer seems to be out-of-date, as it does not specify version. I have the same problem, it issue new cookies in the `api` routes, but there is nothing that ressembles this in Laravel 9. – E. Zacarias Apr 30 '22 at 18:43