Does the jruby-rack servlet container support PUT/DELETE?

416 Views Asked by At

I'm trying to deploy a Rails app as a WAR using Warbler. I have it running in Tomcat 6 and it seems to be running fine. However, all of my PUT and DELETE requests are getting rejected with a 403 (Forbidden).

From what I've been able to gather, the default Tomcat install on Debian/Ubuntu has these methods disabled via:

<init-param>
   <param-name>readonly</param-name>
   <param-value>true</param-value>
</init-param>

I've tried setting this to false in my /etc/tomcat6/web.xml but no dice. I wonder if I have to do something similar to the jruby-rack servlet container packaged by Warbler in my WAR? If so, how would I go about this?

If not, why would Tomcat be rejecting all of the PUTs and DELETEs being sent to my Rails app?

3

There are 3 best solutions below

2
David W On BEST ANSWER

Just for extra detail, here is the relevant bug on jruby-rack:

https://github.com/jruby/jruby-rack/issues/105

It looks like a fix is in progress at the time of this writing.

0
Yacine Zalouani On

I had the same problem. I changed the version of the jruby-rack gem from 1.1.5 to 1.1.4 and now it works fine.

0
kares On

for the record for issues like these - specific to the RackFilter one can always try using the servlet operation mode as a workaround, just remove the filter declaration (and mapping) and declare and map the RackServlet :

<!--
<filter>
  <filter-name>RackFilter</filter-name>
  <filter-class>org.jruby.rack.RackFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>RackFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>-->

<servlet>
  <servlet-name>RackServlet</servlet-name>
  <servlet-class>org.jruby.rack.RackServlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>RackServlet</servlet-name>
  <url-pattern>/*</url-pattern>
</servlet-mapping>

in case you're using warbler copy the web.xml.erb into your config directory:

cp [GEM_HOME]/gems/warbler-1.3.4/web.xml.erb config