2

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?

Matt Zukowski
  • 4,469
  • 4
  • 37
  • 38

3 Answers3

3

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.

Yacine Zalouani
  • 7,999
  • 6
  • 25
  • 24
2

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
kares
  • 7,076
  • 1
  • 28
  • 38
1

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.

David W
  • 324
  • 1
  • 13
  • Looks like this was patched in https://github.com/jruby/jruby-rack/commit/c42ee20e3d15b6c4a8cf316cafcf3bd5410cdfca. Haven't had a chance to try this out yet though. – Matt Zukowski May 10 '12 at 20:27
  • 1
    jruby-rack **1.1.6** is released fixing this regression, alternatively using the servlet operation mode would have worked as a workaround for this case thus I've added another anwser just in case someone gets stucked with a similar issue. – kares May 16 '12 at 08:29