[Catalyst] A different approach to static content

Christopher H. Laco claco at chrislaco.com
Tue Aug 16 18:29:22 CEST 2005


I wanted to start a new thread on this topic to gather and ideas, 
opinions, or flames about serving static content under a Catalyst 
application.

In the current state of affairs, A Catalyst app handles all requests for 
its app domain. This is based on cookbook examples like these 
http://search.cpan.org/dist/Catalyst/lib/Catalyst/Manual/Cookbook.pod#Serving_with_Apache

In order to serve static content, on has to either load 
Catalyst::Plugin::static and configure it, or add Alias/Location 
directives to httpd.conf to have apache bypass the handler for /.

While there's nothing particularly wrong with this approach, it seems 
rather dirty and more work that it should be. I thinks it's possible to 
have the Catalyst app Do The Right thing, if the developer so chooses.

What I'd like to propose is the following [if possible]: when a Catalyst 
app is loaded into MP via PerlModule MyCatalystApp, that the Catalyst 
setup code dynamically adds <Location> handlers to apache for all of its 
public actions (urls). This seems to be the best of both worlds. It only 
handles requests the it has actions for, and apache servers static or 
other types of contents uner lib/root like it always has; all without 
the need to constantly tweak the httpd.conf or tweak the Static plugin.

I'm not sure this kind of change should be the default for a Catalyst 
app, so maybe this can be shuffled into a custom 
Catalyst::Engine::Apache::Static engine so peple can speficy to use that 
engine in their app instead of the stock one.

This is all theory at this point. Thoughts?

-=Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20050816/1816ba67/smime.bin


More information about the Catalyst mailing list