Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
On 31/08/06, Jason Kohles [EMAIL PROTECTED] wrote: On 8/30/06, Matt S Trout [EMAIL PROTECTED] wrote: On 30/08/06, Jason Kohles [EMAIL PROTECTED] wrote: On 8/29/06, Matt S Trout [EMAIL PROTECTED] wrote:If somebody could write this up for Engine::FastCGI in the form of a patch I'm sure it could ship in 5.7002 I started to, but the workaround involves changing some environment variables in ways that (for Apache at least) require knowledge of the Apache configuration that FastCGI doesn't make available to the OK, how about a *documentation* patch outlining the issue and possible workarounds then please?Fair enough, see attachment...Thanks I have this now. I'll fold this into a new manual page Catalyst::Manual::Deployment for troubleshooting more deployment issues. Anyone else with any other deploymet gotchas they'd like to see included please let me know! ___ List: Catalyst@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/
Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
On 8/30/06, Matt S Trout [EMAIL PROTECTED] wrote: On 30/08/06, Jason Kohles [EMAIL PROTECTED] wrote: On 8/29/06, Matt S Trout [EMAIL PROTECTED] wrote: If somebody could write this up for Engine::FastCGI in the form of a patch I'm sure it could ship in 5.7002 I started to, but the workaround involves changing some environment variables in ways that (for Apache at least) require knowledge of the Apache configuration that FastCGI doesn't make available to the OK, how about a *documentation* patch outlining the issue and possible workarounds then please? Fair enough, see attachment... -- Jason Kohles [EMAIL PROTECTED] - http://www.jasonkohles.com/ A witty saying proves nothing. -- Voltaire FastCGI.diff Description: Binary data ___ List: Catalyst@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/
Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
I have had this problem since 5.33 I think. just wrote it off as a configuration problem and PEBKAC:) andreas On 29. aug. 2006, at 03.02, Daisuke Maki wrote: I just got bit by this last night with lighttpd + FastCGI and was wondering, too. My quick and dirty fix for lighttpd was $path = $base_path . ($ENV{PATH_INFO} || $ENV{SCRIPT_NAME} || ''); in Catalyst::Engine::CGI. However, after some sleep and reading other solutions, it does seem that subclassing the App or a base controller class would be better. is this a problem with FastCGI + Catalyst 5.7+? I was vaguely thinking that this is a problem with lighttpd + FastCGI, but OP's report suggests that it doesn't work on Apache either, so... --d Mark Blythe wrote: Hey Jason, I think you're having the same problem I had back in June. I was amazed that nobody else seemed to have been having this issue. I guess it just took a few months. :-) Anyway, here's the solution message I posted, which has been working fine for me since then. Take a look and see if it will work for you: http://lists.rawmode.org/pipermail/catalyst/2006-June/008361.html I have this in my app as a Catalyst plugin. Mark On 8/28/06, Jason Kohles [EMAIL PROTECTED] wrote: I've been struggling for a while now to get an app working under FastCGI, mostly under Apache, although I did briefly experiment with lighttpd, it gave me the same results. In a nutshell, the problem is this, I setup an application using this configuration (which I found in the documentation): FastCgiExternalServer /tmp/test -socket /tmp/test.socket VirtualHost *:80 ServerName test.domain.com ServerAdmin [EMAIL PROTECTED] DocumentRoot /var/www/html Alias / /tmp/test/ /VirtualHost When running a Catalyst app with this configuration, what happens is that any URL that is one level off the root, and ends with a / ends up at the main controllers index method. You can demonstrate this with a very basic modification of a generic application, just use 'catalyst.pl Test' to create a test app, then put these two methods in Controller::Root: sub default : Private { my ( $self, $c ) = @_; $c-response-body( This is default ); } sub index : Private { my ( $self, $c ) = @_; $c-response-body( This is index ); } Loading this application as http://test.domain.com/ should return 'This is index', while any other url on the server should say 'This is default'. What happens however, is that if you request a URL such as http://test.domain.com/foo/, you also get 'This is index'. The reason for this is that Catalyst::Engine::FastCGI inherits from Catalyst::Engine::CGI. Catalyst::Engine::CGI::prepare_path() has this code: $base_path = $ENV{SCRIPT_NAME} || '/'; When using the CGI interface, this works fine, and most of the time this seems to work fine for FastCGI as well, except when you use URL such as http://test.domain.com/foo/, what happens is that Apache (or mod_fastcgi) sets up these environment variables as: SCRIPT_NAME = '/foo' PATH_INFO = '/' Rather than the values you would expect them to have, which should be: SCRIPT_NAME = '/' PATH_INFO = '/foo' This seems to be a fairly common problem (there are bugs that mention similar behaviour in the bug tracking queues for lighttpd, rt, trac, zope, and several others), although I haven't been able to find a solution anywhere. I'm trying to use fastcgi with the external server so that I can have different apps using different perl installs for deployment purposes, which is a lot trickier with mod_perl, although if I can't get this working, I may have to bite the bullet and see about doing something ugly with mod_perl to make it happen. -- Jason Kohles [EMAIL PROTECTED] - http://www.jasonkohles.com/ A witty saying proves nothing. -- Voltaire ___ List: Catalyst@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/ ___ List: Catalyst@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/ ___ List: Catalyst@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/ ___ List: Catalyst@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/
Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
On 30/08/06, Jason Kohles [EMAIL PROTECTED] wrote: On 8/29/06, Matt S Trout [EMAIL PROTECTED] wrote: Andreas Marienborg wrote: I have had this problem since 5.33 I think. just wrote it off as a configuration problem and PEBKAC:) If somebody could write this up for Engine::FastCGI in the form of a patch I'm sure it could ship in 5.7002I started to, but the workaround involves changing some environmentvariables in ways that (for Apache at least) require knowledge of the Apache configuration that FastCGI doesn't make available to the... snip ...OK, how about a *documentation* patch outlining the issue and possible workarounds then please? ___ List: Catalyst@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/
Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
If somebody could write this up for Engine::FastCGI in the form of a patch I'm sure it could ship in 5.7002 If anybody is interested, I've attached the tiny plugin I wrote to solve this issue for Lighttpd. I've been using this for local development for several months. I agree, it'd be best to patch the engine if it can be done in a way that works for all webservers. I don't yet have the free time to test with Apache as well. package Catalyst::Plugin::Lighttpd; # $Id$ BEGIN { our $VERSION = (split(' ', q$Revision$))[1]; } use strict; sub handle_request { my ($class, %args) = @_; if (exists $args{env}) { # lighttpd seems to report these backward $args{env}{PATH_INFO} ||= delete $args{env}{SCRIPT_NAME}; } $class-NEXT::handle_request(%args); } 1; =head1 NAME Catalyst::Plugin::Lighttpd - Fix Lighttpd path info =head1 SYNOPSIS use Catalyst qw(Lighttpd); =head1 DESCRIPTION Lighttpd seems to report PATH_INFO and SCRIPT_NAME differently than Apache and most other web servers. This causes Catalyst to always route URLs with trailing slashes to the application's default action. This plugin will fix that. ___ List: Catalyst@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/
Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
Hey Jason, I think you're having the same problem I had back in June. I was amazed that nobody else seemed to have been having this issue. I guess it just took a few months. :-) Anyway, here's the solution message I posted, which has been working fine for me since then. Take a look and see if it will work for you: http://lists.rawmode.org/pipermail/catalyst/2006-June/008361.html I have this in my app as a Catalyst plugin. Mark On 8/28/06, Jason Kohles [EMAIL PROTECTED] wrote: I've been struggling for a while now to get an app working under FastCGI, mostly under Apache, although I did briefly experiment with lighttpd, it gave me the same results. In a nutshell, the problem is this, I setup an application using this configuration (which I found in the documentation): FastCgiExternalServer /tmp/test -socket /tmp/test.socket VirtualHost *:80 ServerName test.domain.com ServerAdmin [EMAIL PROTECTED] DocumentRoot /var/www/html Alias / /tmp/test/ /VirtualHost When running a Catalyst app with this configuration, what happens is that any URL that is one level off the root, and ends with a / ends up at the main controllers index method. You can demonstrate this with a very basic modification of a generic application, just use 'catalyst.pl Test' to create a test app, then put these two methods in Controller::Root: sub default : Private { my ( $self, $c ) = @_; $c-response-body( This is default ); } sub index : Private { my ( $self, $c ) = @_; $c-response-body( This is index ); } Loading this application as http://test.domain.com/ should return 'This is index', while any other url on the server should say 'This is default'. What happens however, is that if you request a URL such as http://test.domain.com/foo/, you also get 'This is index'. The reason for this is that Catalyst::Engine::FastCGI inherits from Catalyst::Engine::CGI. Catalyst::Engine::CGI::prepare_path() has this code: $base_path = $ENV{SCRIPT_NAME} || '/'; When using the CGI interface, this works fine, and most of the time this seems to work fine for FastCGI as well, except when you use URL such as http://test.domain.com/foo/, what happens is that Apache (or mod_fastcgi) sets up these environment variables as: SCRIPT_NAME = '/foo' PATH_INFO = '/' Rather than the values you would expect them to have, which should be: SCRIPT_NAME = '/' PATH_INFO = '/foo' This seems to be a fairly common problem (there are bugs that mention similar behaviour in the bug tracking queues for lighttpd, rt, trac, zope, and several others), although I haven't been able to find a solution anywhere. I'm trying to use fastcgi with the external server so that I can have different apps using different perl installs for deployment purposes, which is a lot trickier with mod_perl, although if I can't get this working, I may have to bite the bullet and see about doing something ugly with mod_perl to make it happen. -- Jason Kohles [EMAIL PROTECTED] - http://www.jasonkohles.com/ A witty saying proves nothing. -- Voltaire ___ List: Catalyst@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/ ___ List: Catalyst@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/
Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
I've been asleep at the wheel on this one... handelframework.org is running as FastCGI under Apache... Here's my config in case it helps FastCgiServer /www/handelframework.com/lib/HandelSite/script/handelsite_fastcgi.pl -processes 3 VirtualHost Alias / /www/handelframework.com/lib/HandelSite/script/handelsite_fastcgi.pl/ Directory /www/handelframework.com/lib/HandelSite Options +Indexes Order Deny,Allow Deny From All Allow From All /Directory /VirtualHost Although, I haven't upgraded to 5.7 yet... signature.asc Description: OpenPGP digital signature ___ List: Catalyst@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/
Re: [Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
I just got bit by this last night with lighttpd + FastCGI and was wondering, too. My quick and dirty fix for lighttpd was $path = $base_path . ($ENV{PATH_INFO} || $ENV{SCRIPT_NAME} || ''); in Catalyst::Engine::CGI. However, after some sleep and reading other solutions, it does seem that subclassing the App or a base controller class would be better. is this a problem with FastCGI + Catalyst 5.7+? I was vaguely thinking that this is a problem with lighttpd + FastCGI, but OP's report suggests that it doesn't work on Apache either, so... --d Mark Blythe wrote: Hey Jason, I think you're having the same problem I had back in June. I was amazed that nobody else seemed to have been having this issue. I guess it just took a few months. :-) Anyway, here's the solution message I posted, which has been working fine for me since then. Take a look and see if it will work for you: http://lists.rawmode.org/pipermail/catalyst/2006-June/008361.html I have this in my app as a Catalyst plugin. Mark On 8/28/06, Jason Kohles [EMAIL PROTECTED] wrote: I've been struggling for a while now to get an app working under FastCGI, mostly under Apache, although I did briefly experiment with lighttpd, it gave me the same results. In a nutshell, the problem is this, I setup an application using this configuration (which I found in the documentation): FastCgiExternalServer /tmp/test -socket /tmp/test.socket VirtualHost *:80 ServerName test.domain.com ServerAdmin [EMAIL PROTECTED] DocumentRoot /var/www/html Alias / /tmp/test/ /VirtualHost When running a Catalyst app with this configuration, what happens is that any URL that is one level off the root, and ends with a / ends up at the main controllers index method. You can demonstrate this with a very basic modification of a generic application, just use 'catalyst.pl Test' to create a test app, then put these two methods in Controller::Root: sub default : Private { my ( $self, $c ) = @_; $c-response-body( This is default ); } sub index : Private { my ( $self, $c ) = @_; $c-response-body( This is index ); } Loading this application as http://test.domain.com/ should return 'This is index', while any other url on the server should say 'This is default'. What happens however, is that if you request a URL such as http://test.domain.com/foo/, you also get 'This is index'. The reason for this is that Catalyst::Engine::FastCGI inherits from Catalyst::Engine::CGI. Catalyst::Engine::CGI::prepare_path() has this code: $base_path = $ENV{SCRIPT_NAME} || '/'; When using the CGI interface, this works fine, and most of the time this seems to work fine for FastCGI as well, except when you use URL such as http://test.domain.com/foo/, what happens is that Apache (or mod_fastcgi) sets up these environment variables as: SCRIPT_NAME = '/foo' PATH_INFO = '/' Rather than the values you would expect them to have, which should be: SCRIPT_NAME = '/' PATH_INFO = '/foo' This seems to be a fairly common problem (there are bugs that mention similar behaviour in the bug tracking queues for lighttpd, rt, trac, zope, and several others), although I haven't been able to find a solution anywhere. I'm trying to use fastcgi with the external server so that I can have different apps using different perl installs for deployment purposes, which is a lot trickier with mod_perl, although if I can't get this working, I may have to bite the bullet and see about doing something ugly with mod_perl to make it happen. -- Jason Kohles [EMAIL PROTECTED] - http://www.jasonkohles.com/ A witty saying proves nothing. -- Voltaire ___ List: Catalyst@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/ ___ List: Catalyst@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/ ___ List: Catalyst@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/