1

== Bad Request

Your browser sent a request that this server could not understand.

Size of a request header field exceeds server limit.

Hi! I am using many cookies in my php application. Cookies are large and contains a lot of information, but all the time is showing the above error. Saying that the limit was exceeded cookie or something.

I wonder if it has the resolve to increase the limit of cookies.

Type using htaccess? Or a header in php?

user2635410
  • 19
  • 1
  • 2
  • http://stackoverflow.com/questions/686217/maximum-on-http-header-values you should not be storing that much data in a cookie, so the proper answer is "you don't increase the limit. you decrease how much data you're trying to ram down your system's throat. – Marc B Jul 30 '13 at 18:49
  • @MarcB that is not **always** an option. – pattyd Jul 30 '13 at 18:50
  • 1
    @pattyd: you can increase server limits all you want, but browser have their own cookie size limit which you have NO control over. cookies should be short & sweet. there's better alternatives for shoving that much data around. – Marc B Jul 30 '13 at 18:51

3 Answers3

4

Maybe try to add this line in your apache conf file :

LimitRequestFieldSize 16380

And restart apache

Freelancer
  • 4,459
  • 2
  • 22
  • 28
1

A cookie isn't meant to be a massive store of data. Don't forget every HTTP request someone makes with your cookie requires that all the data in the cookie gets sent every time. An abnormally big cookie plus lots of users means you'll quickly get overwhelmed.

You should use a session, either PHP native or your own implementation that uses the cookie only to identify the user, and keep their actual data on the server in temp files or the database (PHP's session uses temp files by default, and you can implement a handler to make it use a database or other methods of storage).

Modern browsers also implement local storage techniques other than cookies that you can use, if you don't have resources to keep a lot of data on the server and don't mind your application not working with older browsers that don't support local storage.

GordonM
  • 31,179
  • 15
  • 87
  • 129
0

Seems a problem with the server. But so much cookies is a bad design. Every time a site is requested all cookies are send with in the header, consuming bandwidth and traffic. You fuck up every mobile and slow b/w users.

you should store all information in a php session and send only the session cookie to the client

http://webdesign.about.com/od/cookies/f/cookies-per-domain-limit.htm

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57