[Catalyst] Re: uri_for() not working under lighttpd fastcgi

Kieren Diment diment at gmail.com
Sat Sep 15 14:52:12 GMT 2007


This was a major pain when I was getting WIAB out the door and into
the wild.  The solution for non-root deployment on lighttpd is to add
the following rewrite rule into the lighttpd config:

url.rewrite = ( "fastcgi\$" => "fastcgi/" )
\$HTTP["url"] =~ "/fastcgi" {

(assuming deployment on http://mydomain/fastcgi)

Essentially it's caused by not-quite-a-bug-but-almost in lighttpd
(i.e. non identical behaviour to apache) which I believe is something
to do with env variables.  Catalyst doesn't know the web server
details in front of the fast cgi process so there's not much we can do
to work around the problem, except fix the Engine::FastCGI docs, which
I'm going to do right now before I go to bed...


some nice little test harnesses for testing for these <sarcasm> fun,
rewarding and fulfilling </sarcasm> issues here:

http://websiteinabox.googlecode.com/svn/trunk/WIAB/t/optional_lighttpd-fastcgi-non-root.pl
http://websiteinabox.googlecode.com/svn/trunk/WIAB/t/optional_apache-fastcgi.pl
http://websiteinabox.googlecode.com/svn/trunk/WIAB/t/optional_lighttpd-fastcgi.pl


On 15/09/2007, Jim Spath <jspath at pangeamedia.com> wrote:
> Carl Franks wrote:
> > I discovered that if instead of hitting:
> >     http://my-domain/amazon
> > I hit:
> >     http://my-domain/amazon/
> >
> > ... then uri_for() started working as expected.
> >
> > I added a rewrite rule to my lighttpd config:
> >     url.rewrite = ( "^/amazon$" => "/amazon/" )
> > and everything is now working again.
> >
> > I don't know if this is the best solution though.

Should have read the rest of the message.  Yes this is the best solution.

> >
> > Cheers,
> > Carl
>
> I have run into this same issue... on our development lighttpd server
> the Catalyst application is accessible through URLs like:
>
>    http://domain/~user/myapp/
>
> If you didn't include the trailing slash, Catalyst would set
> $c->request->base incorrectly.
>
> Our solution was simply to force trailing slashes (although I am having
> trouble finding this configuration option), which really just works
> around the core Catalyst issue.  I'll see if I can dig up more on this.
>
> - Jim
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>



More information about the Catalyst mailing list