[Catalyst] serving static content from one controller?
Dustin Suchter
dsuchter at ucla.edu
Fri Oct 5 12:47:20 GMT 2007
Thanks for all the replies- best mailing list ever.
Anyway, I'm planning on running lighttpd, but to date I've just been
developing with the built in Catalyst server since I've had a bit of
an issue getting FastCGI/lighttpd working right on my server. I
guess it is time to fix that and then implement the solution to my
question here...
thanks again everyone,
-d
Ash Berlin wrote:
> Jonathan Rockway wrote:
>> Dustin Suchter wrote:
>>> 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.
>> This is probably not the best idea. It would be better for your
>> Catalyst app to inform your web server as to what static page to serve.
>> perlbal calls this an "internal redirect", and lighttpd calls it
>> "X-SendFile". Please look into those; all your cat app will have to do
>> is send an HTTP header with the name of the file, and the web server
>> will take care of the rest.
>>
>> This has come up before, I think, so grep the list archives for more detail.
>>
>> Failing that, you can always set $c->res->body to a filehandle:
>>
>> sub send_static :Private {
>> my ($self, $c, $filename) = @_;
>> open my $fh, '<', $filename or die "failed to open $filename: $!";
>> $c->res->body($fh);
>> $c->detach;
>> }
>>
>> Hopefully the internal redirects will work out for you, though. Good luck.
>>
>> Regards,
>> Jonathan Rockway
>
> Another option instead of using X-SendFile for lighttpd is to do as I
> describe in http://perlitist.com/articles/catalyst-with-lighttpd
>
> If you are using apache and want to achieve something similar with
> static files let me know and I can show you the config you'd need to get
> the same affect (Apache to serve the static stuff)
>
> -ash
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/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