Perlbal - URL Matching Plugin

This is Interesting: Free IT Magazines  
Home > Archive > Perlbal > September 2006 > URL Matching Plugin





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author URL Matching Plugin

2006-09-01, 1:12 am

For what it's worth, I've written a very simple URL matching plugin
for perlbal at http://jeremy.publication.org.uk/Urlmatch.pm

It's based heavily on Vhosts, since it basically does the same thing
with slightly different criteria, with the intention of being able to
serve directories of static files much quicker than something like
Apache, but still pass through any requests to dynamic content.

A good modification would be to be able to re-write URLs to be
relative to a static root (at the moment, it passes through the whole
URL to the web_server part), but this is ok for us since docroot can be
the same as used by apache.

Imaginary crazy config would be something like (it's a psuedo-apache
matching syntax. * matches non-slashes. ** matches all)...

LOAD urlmatch

CREATE SERVICE static
SET role = web_server
SET docroot = /var/www/
ENABLE static

CREATE POOL apache
POOL apache ADD 127.0.0.1:8000
CREATE SERVICE redir
SET role = reverse_proxy
SET pool = apache
SET persist_backend = on
ENABLE redir

CREATE SERVICE urlmatch
SET listen = 0.0.0.0:80
SET role = selector
SET plugins = urlmatch
SET persist_client = on

URL /**/images/** = static
URL /styles/autostyles.css = redir
URL /styles/* = static

URL /** = redir # This should match everything else
ENABLE urlmatch

....I'm just making this up, but typically you might just have a static
directory you want served directly, and everything else dynamic. Each
URL is checked in turn against those specified for the first available
match.

Comments, Suggestions, Fixes, Complete Re-Writes, Abject Criticism,
Inclusion into perlbal Source Tree etc. all welcome.

Jeremy

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com