Search code examples
jquery-mobileruby-on-rails-3.1passengerthinwebrick

Getting 411 Length Required Error when using remote link with jQuery Mobile inside android device


I'm getting this error when open a jQuery Mobile web with put/post ajax(remote) link inside an android device and trying to click on these link. The problem happens with Rails 3.1 running on WebRick and Passenger. Problem seem to vanish if I use thin. Though, I prefer Passenger for production server.

Any thing I should tweak in Passenger to shoot this error away?


Solution

  • It turns out to be some problem with the combination of jQuery Mobile + Android Webkit that causes a POST request with empty body to raise this error. I make a hack to rails ujs to use a hash of timestamp ( { timestamp: (new Date()).getTime() } ) as body of any non-GET request with empty body and the problem goes away.