[Catalyst] request uri under lighttpd/fastcgi contains extra slash

Kieren Diment diment at gmail.com
Fri Nov 9 21:15:07 GMT 2007


On 10 Nov 2007, at 03:48, Andy Grundman wrote:

>
> On Nov 9, 2007, at 11:26 AM, Jim Spath wrote:
>
>> When I run Catalyst out of a non root webserver location, e.g. / 
>> myapp, $c->request->uri has an extra slash after the base url.
>>
>>  http://mydomain.com/myapp//
>>  http://mydomain.com/myapp//some/action
>>
[snip]
>> FYI, my lighttpd fastcgi config looks like:
>> $HTTP["url"] =~ "^/myapp/(?!static)" {
>>  fastcgi.server = (
>>   "/myapp" => (
>>     "MyApp" => (
>>       ...
>> [snip]

>> and I am currently running Catalyst 5.7007.  I'd prefer a solution  
>> that doesn't involve upgrading Catalyst... if that is possible.
>
> Please at least test your app with the latest Catalyst version.   
> There's a reason we put out new releases, to fix bugs like this  
> one. :)
>
> I just ran our test suite against lighttpd 1.4.18 and the latest  
> Catalyst with a non-root path and it is fully passing.


Andy and I spent a good long time sorting this one out for Catalyst  
5.7004 so you should be right not to upgrade.

I think the problem is that your config is missing this rewrite rule:

url.rewrite = ( "myapp\$" => "myapp/" )

Here's the lighttpd non-root config from the catalyst test suite, use  
this as a basis to fix your issue:

my $conf = <<"END";
# basic lighttpd config file for testing fcgi+catalyst
server.modules = (
     "mod_access",
     "mod_fastcgi",
     "mod_rewrite",
     "mod_accesslog"
)

server.document-root = "$docroot"

server.errorlog    = "$docroot/error.log"
accesslog.filename = "$docroot/access.log"

server.bind = "127.0.0.1"
server.port = $port

# Work around inability to hit http://localhost/deep/path
# without a trailing slash
url.rewrite = ( "deep/path\$" => "deep/path/" )

# catalyst app specific fcgi setup
fastcgi.server = (
     "/deep/path" => (
         "FastCgiTest" => (
             "socket"       => "$docroot/test.socket",
             "check-local"  => "disable",
             "bin-path"     => "$docroot/TestApp/script/ 
testapp_fastcgi.pl",
             "min-procs"    => 1,
             "max-procs"    => 1,
             "idle-timeout" => 20
         )
     )
)
END



More information about the Catalyst mailing list