[Dancer-users] solving starman error with dancer's .psgi file
Mr. Puneet Kishor
punk.kish at gmail.com
Sat Jul 9 23:54:44 CEST 2011
In httpd.conf
ProxyPass /foo http://127.0.0.1:5001
ProxyPassReverse /foo http://127.0.0.1:5001
and foo.psgi file like so
use Dancer ':syntax';
use Plack::Builder;
setting apphandler => 'PSGI';
my $app = sub {
my $env = shift;
local $ENV{DANCER_APPDIR} = "/Users/punkish/Documents/www/foo";
setting appdir => "/Users/punkish/Documents/www/foo";
load_app "foo";
Dancer::App->set_running_app("foo");
Dancer::Config->load;
my $request = Dancer::Request->new( env => $env );
Dancer->dance( $request );
};
builder {
enable "Static", path => sub { s!^/lib/!! }, root => "/Users/punkish/Sites/lib";
mount "/" => builder {$app};
};
I start the above with
$plackup -E development -s Starman --workers=10 -p 5000 -a foo.psgi
The above works fine if I go to http://localhost.local/foo/, but if I go to http://localhost.local/foo (no trailing slash), all the resources at /lib are unreachable.
But, here is a more confounding problem; to access the above as an apache virtual host, I change httpd.conf to
<VirtualHost foo.local:80>
ProxyPass / http://127.0.0.1:5001/
ProxyPassReverse / http://127.0.0.1:5001/
</VirtualHost>
and change only the following line in foo.psgi to
- mount "/" => builder {$app};
+ mount "http://foo.local" => builder {$app};
But, now I get the following error
Error while loading foo.psgi: Paths need to start with / at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/Plack/Builder.pm line 89
More information about the Dancer-users
mailing list