Static::Simple seems to have some configuration options to force certain
paths as static only
Practical examples can be found here
http://search.cpan.org/~jrockway/Catalyst-Manual-5.701002/lib/Catalyst/Manual/Cookbook.pod#Serving_static_content
MyApp->config->{static}->{dirs} = [
'static',
qr/^(images|css)/,
];
If you're serving your app under apache, you can set an Alias directive
that bypasses catalyst for your static content.
DocumentRoot /var/www/APP/root
Alias / /tmp/app.fcgi/
Alias /static /var/www/APP/root/static
If you want to serve from your /public controller because static simple
doesn't do something you want, you might use something like this
sub index : Private {
my $self = shift;
my $c = shift;
my $static_fn = $c->path_to( 'public', @_ );
if ( -e $static_fn ) {
$c->serve_static_file( $static_fn );
}
else {
$c->detach( 'error404' );
}
}
sub error404 : Private {
my ( $self, $c ) = @_;
$c->res->redirect( $c->uri_for('/'));
$c->detach();
}
For more help, read over the documentation on deployment, starting with
the cookbook:
http://search.cpan.org/~jrockway/Catalyst-Manual-5.701002/lib/Catalyst/Manual/Cookbook.pod#Deployment
/Mitch
Dustin Suchter wrote:
So I've got what has to be a pretty common problem: I've built a
system that is 95% behind some authentication, and 5% public. I'd
like to have the entire public portion be static HTML files that are
all served from the '/public/' directory. I've created a "Public"
controller and the corresponding directory to hold static HTML
content. I've also modified the system such that either the Public
controller or the Login controller can be access by unauthenticated
users.
How do I go about serving the static pages, for example my page
"books_intro.html"?
I've looked into "Static::Simple", but I can't find a good
manual/tutorial on it. I've tried to guess at how to use it but I
pretty much didn't get anywhere.
thanks,
-d
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/