[Catalyst] Serving server-dependent static content

Alejandro Imass alejandro.imass at gmail.com
Tue Aug 14 21:42:34 GMT 2007


IMHO you should let each component do what it does best. Web servers
are specialized for static content so le IT do this work. Your app is
specialized in dyn content so let IT do the work.

Here is an example apache2 conf to handle cat / static content. In
this app, both standard cat static content _and_ a file system
folder-based document library (biblioteca in the example) are viewed
through cat but served by Apache. This setup yields GREAT performance
gains, besides all the other benefits like taking advantage of other
apache plug-in for specific content, security, etc. For example this
site, has mp3 content which is served in streaming mode directly by an
apache module SPECIALIZED for this.

        # Sample Aliases
        Alias /estadisticas /var/www/vdc/root/static/usage/
        Alias /static /var/www/vdc/root/static
        Alias /biblioteca /var/vdc/biblioteca
        Alias / /var/www/vdc/script/vdc_cgi.pl

        # They cat part via mod_perl
        <Location />
                SetHandler modperl
                PerlResponseHandler vdc
        </Location>

        # static docs served by apache directly
        <Location /static>
                SetHandler default-handler
        </Location>
        <Location /biblioteca>
                SetHandler default-handler
        </Location>


For the curious, the application can be browsed in the link below
(even though it may seem so, there is 0% Flash, very little JS and
mostly TT tricks and CSS (and cat of course)). All back-end apps were
built with HTML::Widget, believe it or not ;-)

http://vozdeloscreadores.gob.ve




On 8/13/07, Pedro Melo <melo at simplicidade.org> wrote:
> Hi,
>
> On Aug 12, 2007, at 8:59 PM, mreece at vinq.com wrote:
>
> >> On 8/12/07, Peter Lytle <pete at bluecampaigns.com> wrote:
> >>> If someone has a  solution from the Apache side, that's fine but I
> >>> suspect that it might be
> >>> easier  to do this with Catalyst::Plugin::Static::Simple
> >>
> >> Don't serve static content through perl.  Let your webserver do it.
> >> Usually people just set up virtual hosts with different
> >> DOCUMENT_ROOTs.  Is there a reason that won't work for you?
> >>
> >> - Perrin
> >
> > a lot of times, 'static' content is found via database queries.  and
> > sometimes that content needs to be protected from unauthorized
> > viewers,
> > and your authorization mechanisms are already built into your
> > application,
> > so you can't just use Alias/Rewrite directives to still have apache
> > serve
> > up that tree.
>
> In those cases, pick a server that understands Reproxy:
>
>   1. hit goes through webserver into cat;
>   2. cat does all the authorization stuff
>   3. cat sends back header saying "Ok, webserver, send this static
> file": Reproxying
>   4. webserver spoon feeds slow clients.
>
> Both lighttpd and perlbal support this. I don't know if latest apache
> also does.
>
> Best regards,
> --
> Pedro Melo
> Blog: http://www.simplicidade.org/notes/
> XMPP ID: melo at simplicidade.org
> Use XMPP!
>
>
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/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