in reply to mod_perl how to process static content

Each "virtual host" in the Apache environment is described by a series of directives, in this case particularly including Alias, ScriptAlias, and Directory. These directives tell Apache what to do with each URI.

If you are using mod_rewrite, these rules are applied to the rewritten URI.

In this case, you want certain aliases such as images/blah to simply be served from a certain existing disk-directory. The Alias directive can do that. (If you're using mod_rewrite, the rules must also allow these URIs to pass-through unchanged.) For these aliases, Apache is just doing what Apache normally does:   scooping-up the content of a file and shoving it down the pipe. The browser's also doing what it does best, caching things and not asking for them a second time unless it thinks it has to.

You control what actually gets sent to (Perl), and this should be:   only the content that truly must be generated by a (Perl) program.

What you are shooting-for is definitely a good thing, by-the-way. Let Apache do what it already knows how to do best, whenever possible. Bring Perl into the picture only for things that require a programmed response. Use custom error-documents to keep the overall site look-and-feel consistent while still letting Apache itself do a portion of the “heavy lifting.” Be aware of the natural caching behavior of browsers, also, and make sure that this too is working to your advantage as designed.

Replies are listed 'Best First'.
Re^2: mod_perl how to process static content
by atento (Novice) on Mar 24, 2008 at 18:42 UTC
    Thanks for your wide answer. I'll keep in mind some of your tips. Yes, I researched documentation of mod_rewrite and LocationMatch configuration directive may be useful for. But I founded in google impossible to invert the whole regex in this directive. Eg this code is impossible as I understood:
    <LocationMatch <B>!~</B> /^(images|styles|js)/ > PerlOptions +Parent +GlobalRequest +Autoload PerlSwitches -I/some/path/lib SetHandler perl-script PerlResponseHandler My::Apache::Main </Location>