1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

400 Bad Request due to large cookie

Discussion in 'Apache' started by infowarsDOTcom, Jan 15, 2009.

  1. #1
    Hello folks
    I have been developing an application which heavily uses cookies. I checked out cookie limitations for different browsers and it is saround 20-50 cookies per domain and 4096 chars for each cookie.
    So now I need to use use 6 cookies each containing 3000 chars, which is around 18KB in total.
    Anyway there is no issue at client side, browsers perfectly allow me to set those cookies. however after those cookies are set. Client can no longer communicate due to error: "400 Bad Request Your browser sent a request that this server could not understand. Size of a request header field exceeds server limit."
    So I guess somehow at each request to the server all my cookies also are a part of the request which apache do not handle, I presume.
    Is there any workaround for that? Can you suggest anything?
     
    infowarsDOTcom, Jan 15, 2009 IP
  2. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #2
    Store whatever it is you're storing in a cookie somewhere on the server and identify it using a hash, and just store the hashes in the cookies ?

    A large hash shouldn't be more than maybe 512 bytes.
     
    joebert, Jan 23, 2009 IP
  3. Gangsta

    Gangsta Active Member

    Messages:
    145
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    why are use using such big cookies
    use sessions
     
    Gangsta, Jan 23, 2009 IP
  4. pitagora

    pitagora Peon

    Messages:
    247
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the limit is set somewhere in the configurations of your webserver. If this app is going to run on a VPS or dedicated a quick fix would be to simply change it. If not you will have to rethink your strategy. Do you really need to store that much info? Can't you store it in a DB and only hold a key to it in the cookies? Don't force the user to submit 20k of data on each request! It's exaggerated.
     
    pitagora, Jan 23, 2009 IP