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

Chris Jackson chrisj at shadowcatsystems.co.uk
Fri Nov 9 18:45:15 GMT 2007

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
> Catalyst::Engine::CGI::prepare_path() is setting $base_path to /myapp/, 
> which is correct, 

Well, to begin with, no it isn't. $base_name is derived directly from
PATH_INFO; from RFC3875 "Common Gateway Interface (CGI)," section 4.1.13:

"No PATH_INFO segment (see section 4.1.5) is included in the SCRIPT_NAME

So, the / is either in the PATH_INFO (which it should be) or the
SCRIPT_NAME, it shouldn't be in both.

On the other hand, you're using FastCGI, so you may be better looking at
Catalyst::Engine::FastCGI. This has a had a known problem with lighttpd
(see http://lists.scsys.co.uk/pipermail/catalyst/2006-June/008361.html).
The fix there has been integrated into Catalyst now (and was before
7.007), but it's possible it may not be perfect. If lighttpd is indeed
leaving the slash on the end of SCRIPT_NAME (which may or may not be
PATH_NAME at the time), it may cause this effect. I'm afraid I don't
have one available for testing, but I hope that gives you some hints ;)

Chris Jackson
Shadowcat Systems Ltd.

More information about the Catalyst mailing list