Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Apache Bad Request

  1. #1
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default Apache Bad Request

    I've got a site that has a large form that I split up into several pages. I'm using php sessions to gather data as the pages go along. The trouble is, though, that there are many many fields. After I get about 4 pages in deep out of 5, I get this error:
    Bad Request

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

    I'm also using cookies to keep track of data, so that if a person returns, they will be able to have all the fields pre-filled. Suffice to say, quite a large sum of cookie strings. I'm serializing all the data, so there aren't many cookies, but quite a bit of data in each cookie.

    Is there a setting on the server to adjust to increase the size or another way around this issue?

    Thanks,

  2. #2
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default

    Nevermind. I was corrupting the cookie myself!

  3. #3
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default

    Well, turns out that it wasn't that. I really think that it is a size thing, since I get this error on page 4/5, but if I start on page 3/5 without adding all those values to the session variable, there isn't a problem.

    Is there a way to increase this size on Apache?

  4. #4
    Dmitriy is offline Nearly a Master Glow Jedi
    Join Date
    Feb 2007
    Location
    Ukraine
    Posts
    124

    Default

    Yes, it is. To increase request size in Apache, add directive LimitRequestFieldSize to the configuration file. Default value is 8190 bytes. To increase it 2 times add
    LimitRequestFieldSize 16380. Don't know if it will work from .htaccess. Probably not, so this is the question to support team, but.... I'd strongly suggest you not adding as much data to the cookies as your web-site clients might experience a whole lot of other problems with large cookies. Why don't simply save some pseudo-random hash to clients machine and all the data in your DB? This is also has better security than cookies.

  5. #5
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default

    Quote Originally Posted by Dmitriy View Post
    I'd strongly suggest you not adding as much data to the cookies as your web-site clients might experience a whole lot of other problems with large cookies.
    What kind of problems Dmitriy?
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  6. #6
    Dmitriy is offline Nearly a Master Glow Jedi
    Join Date
    Feb 2007
    Location
    Ukraine
    Posts
    124

    Default

    At least 2 comes into my mind:
    - some browsers have its own limits of cookie size (old versions of Mozilla and some *nix browsers)
    - IE6 and 7 has a known problem of cookies not saving when they run out of Temporary Internet Files storage limit
    Chances of experiencing these might be low, but if the form is vital, like service order form and saving form state is critical - it would be wise to spend more time on development than debug 'strange' bug later, IMO.

  7. #7
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default

    Would a system shut down with an error of Kernel Dump Size be related to extra large cookies?
    It said something about page size...
    Last edited by rlhanson; 02-10-2010 at 05:21 PM. Reason: clarification
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  8. #8
    Dmitriy is offline Nearly a Master Glow Jedi
    Join Date
    Feb 2007
    Location
    Ukraine
    Posts
    124

    Default

    Can't say exactly. The dump is saved when web-server thread crashes, but 400 error (the one that fires when the request too large) is not the one that makes server crash.

    If you need to debug some script that results in creating memory dump, why don't you log $_REQUEST variable at the first few lines of your script? Just don't make it on highly loaded web-sites

  9. #9
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default

    Thanks Dmitriy - I'll pass that comment on to Charles who would know what your talking about.

    I was testing the form, got the bad request notice, logged on to respond here and got the stop error and memory dump thing.

    This form is interacting with another server which has an intranet of sorts that my client works with. Basically the application, when submitted goes into their program they use for property management.
    What we ran into, is if the captcha code was input incorrectly (at the very end of an excruciating form) the form processor reloaded the form page and everything entered was gone. Charles has gotten the form to break into multiple pages with a quick save feature which is what he mentions at the beginning of the thread.

    I think he's using AJAX and php sessions combined to allow the user to come back within 30 days and continue with the application. I'll let Charles think this out and get out of your guys' way...

    Thanks again Dmitriy.
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  10. #10
    Dmitriy is offline Nearly a Master Glow Jedi
    Join Date
    Feb 2007
    Location
    Ukraine
    Posts
    124

    Default

    I see. I'd suggest to make form submit via AJAX, so you don't have to reload anything if something fails - CAPTCHA or any other field that can't be validated on the client side.

    Another thing if you want to save the form state for some time... There are few places we had done that and one of them is GlowHost order form. The main rule to follow - client machine must work only with ids and not whole set of different data types. This might look silly, but in the end it pays back

Page 1 of 2 12 LastLast

Similar Threads

  1. Pop Request Limit?
    By rlhanson in forum General Support
    Replies: 7
    Last Post: 10-18-2007, 10:01 PM
  2. Olga - Bad hard Disk
    By Matt in forum Outages and Scheduled Maintenance
    Replies: 0
    Last Post: 04-05-2007, 12:29 PM
  3. Add URL Request [removed]
    By abbacus in forum Web Design
    Replies: 0
    Last Post: 01-06-2006, 11:54 PM
  4. Bad CGI Errors.. Need Urget Help Please
    By FiberglassForum in forum General Support
    Replies: 1
    Last Post: 11-22-2005, 09:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14