Perlbal and Rails

Cal Henderson calh at
Thu Feb 22 01:34:43 UTC 2007

Philip Murray <pmurray at> wrote:
: Basically, if the file exists locally serve it. If it doesn't exist
: locally, proxy it to one of the backends.
: In a sense this is kind of combining the web_server role with the
: reverse_proxy role, is it curently possible to do this with Perlbal?

you can fairly easily do this by adding a hook to a web server backend 
(via a custom plugin) to check for 404's (the hook is called 
static_get_poststat_file_missing) and then move the request over to a 
proxy backend.

something like (untested):


package Perlbal::Plugin::Thinger;

use strict;
use warnings;

sub register {
 my ($class, $svc) = @_;

 $svc->register_hook('MyHook', 'static_get_poststat_file_missing', sub 

  my ($cb) = @_;

  my $new_svc = Perlbal->service('my_proxy_service');


  return 1;

 return 1;

sub unregister {
 my ($class, $svc) = @_;


 return 1;



More information about the perlbal mailing list