routing error (Recognition failed for "") - mod_fcgid (strange padding problem)

Hi there,

I have a very basic rails application (basically following the
O'Reilly tutorial[1], up to the first controller). This application
works fine if accessed via the WEBRick ./script/server. However, it
does not work via mod_fcgid.

The mod_fcgid version of the server is live so you can see for
yourself, but attempting to access
<http://railsdemo.alcopop.org/my_test/> results in

  Routing Error
  Recognition failed for ""

The strange thing is, if you pad out the URL with some characters at
the beginning, it works. At the time of writing,
<http://railsdemo.alcopop.org/1234569870/my_test/> results in

  Routing Error
  Recognition failed for "est/"

And <http://railsdemo.alcopop.org/123456980123456/my_test/> works.

The number of characters you have to use varies. The first time I
discovered this, it only took 10 (1234567890) to get it to work.

I'm using apache 2.0.54, mod_fcgid 1.05, rails 1.1.6, libfcgi-ruby1.8
version 0.8.6 and ruby 1.8.2.

My apache configuration is available at
<http://alcopop.org/temp/railsdemo.alcopop.org.conf>.

The development.log shows the following for the first example
(accessing just /my_test/):

Processing Base#index (for 82.39.141.17 at 2006-12-17 12:06:31) [GET]
  Session ID: 6803399c5f598e95fa3ab44671fbaced
  Parameters: {}

It shows the following for the padded case that worked:

Processing MyTestController#index (for 82.39.141.17 at 2006-12-17 12:06:34) [GET
]
  Session ID: 6803399c5f598e95fa3ab44671fbaced
  Parameters: {"action"=>"index", "controller"=>"my_test"}
Completed in 0.00094 (1062 reqs/sec) | 200 OK [http://railsdemo.alcopop.org/1234
56980123456/my_test/]

So the Parameters hash is not being populated properly.

This feels to me like a tough problem, but if anyone could hint at
which bit was perhaps broken (apache2, mod_fcgid, rails, etc.) that
would at least help to narrow down the search :slight_smile:

[1] http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html

I was wondering if this was a mismatch between the libfcgi ruby
library and the fastcgi binary I was using. However I have replicated
this using packages entirely from debian testing "Etch" on my desktop:

ii apache2 2.2.3-3.1 Next generation, scalable, extendable web se
ii libapache2-mod 2.0-1 an alternative module compat with mod_fastcg
ii libfcgi-ruby1. 0.8.7-3 FastCGI library for Ruby
ii rails 1.1.6-1 MVC ruby based framework geared for web appl
ii ruby 1.8.2-1 An interpreter of object-oriented scripting