AJAX problem with Lighttpd and jQuery

Thursday, April 16, 2009

While converting the environment of one of my business projects from Apache to Lighttpd, I experienced a problem, which didn't occur with Apache before. The following code worked fine in Aapache:
$.post('http://example.com/ajax');
When executing the same request to Lighttpd, you receive the following error message:
411 - Length Required
The solution was pretty simple, thought I only found it because it was working in another place with a similar case. The solution is to add an empty POST-object to the request (which will then send the content-length header):
$.post('http://example.com/ajax', {});
Hopefully this will help somone who experienced the same problem.

Comments to this article

  • Avatar of pr madison Reply pr madison Thursday, April 23, 2009 12:44 PM

    nice, very nice ;)

Leave a comment

Please note that your email address will not be shown, it is only used to fetch your avatar image from gravatar.com and for notifications.

                       _             
 _ __ ___  _   _ _ __ (_)_   ___   _ 
| '_ ` _ \| | | | '_ \| \ \ / / | | |
| | | | | | |_| | |_) | |\ V /| |_| |
|_| |_| |_|\__,_| .__/|_| \_/  \__, |
                |_|            |___/