HTTP/1.x 411 error with jQuery.post() in Firefox 3
04 March 2009I’ve just stumbled across a problem with using the AJAX $.post() wrapper in jQuery 1.2.6 and Firefox 3.
If you call…
$.post('/do/something.handler');
…jQuery doesn’t seem to generate a Content-Length header and causes IIS to return a HTTP/1.x 411 Length Required error.
To fix this, I’m adding an empty data array…
$.post('/do/something.handler', {});
…which now generates a Content-Length: 0 header and returns the correct response from IIS.
Not sure if this is fixed in jQuery 1.3+ or occurs in other versions of Firefox, but the above seems to fudge it in this scenario.

One Response to “HTTP/1.x 411 error with jQuery.post() in Firefox 3”
Chris Charabaruk | 27 September 2009 at 22:24
I’m running into this problem right now on a site using jQuery 1.3.3, where the site’s user is running Firefox 3.0. The problem doesn’t exist in 3.5, or any other browsers.
Thanks for showing a solution to the problem!
Leave a Reply