Jan 25, 2011

406 error to retrieve jquery.cookie.js file

In a project, I need to use jquery.cookie.js file. It’s weird that this file is already uploaded to the server, and I just could not retrieve it, but got 406 Error. The following is the message I got from Firefox:

Not Acceptable
An appropriate representation of the requested resource /wocai/jquery.cookie.js could not be found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Cannot figure out why, but after I changed the file name to jquery_cookie.js, it fixed the problem. Could the server is not happy file the filename?



  • Thanks, I was almost tearing my hair out with this same problem. Such a simple fix!

  • I can’t believe that we’re the only ones on the entire interwebz that have suffered from this. I’ve been Googling the whole jquery.cookie.js — 406: Not Acceptable thing all day long. Thanks for the suggestion! It worked perfectly. Does anyone know why the file name screws up finding it? Oh well… Thanks again!

  • I just spent an hour dealing with this. Apparently our hosting provider has ModSecurity turned on and that #(@#*$ing thing thinks that jquery.cookie.js is a XSS attack.

    [Thu Jun 23 00:08:53 2011] [error] [client] ModSecurity: Access denied with code 406 (phase 2). Pattern match “(?:\\b(?:(?:type\\b\\W*?\\b(?:text\\b\\W*?\\b(?:j(?:ava)?|ecma|vb)|application\\b\\W*?\\bx-(?:java|vb))script|c(?:opyparentfolder|reatetextrange)|get(?:special|parent)folder|iframe\\b.{0,100}?\\bsrc)\\b|on(?:(?:mo(?:use(?:o(?:ver|ut)|down|move|up)|ve)|key(?:press|d …” at REQUEST_FILENAME. [file “/usr/local/apache/conf/modsec2.user.conf”] [line “113”] [id “950004”] [msg “Cross-site Scripting (XSS) Attack”] [data “.cookie”] [severity “CRITICAL”] [tag “WEB_ATTACK/XSS”]

    • Thanks Todd! I think that is it.

  • Worked for me as well, and it does look like it triggered ModSec. Thanks!

  • THANKS!!!

  • not work for me..

    • Is it 406 error in your case?
      What file name you changed to? You can change to any name, so maybe don’t use “cookie” in the file name.
      You can also try to copy the content of jquery.cookie.js file to another js file to see what happened.

  • Just change the file name. thats all.

  • Amazing! Thank you… I was going nuts for days over this one :)

  • I was lucky read your post within 5 minutes! :)

  • many thanks, I served a lot, my client wanted to kill me now! the question for now is how to make our server does not delete important files on suspicion, I appreciate the post …

  • It worked! What a strange issue!!! Thanks!

Leave a comment