Perlbal and Catalyst

Bill Moseley moseley at hank.org
Tue Apr 1 14:06:01 UTC 2008


I'm testing out Perlbal as a replacement for an Apache reverse proxy
with a mod_perl/Catalyst backend.

The problem I'm having is the headers mod_proxy provides work great
with Catalyst, but the headers from Perlbal do not.

With Apache/mod_proxy the backend gets these headers:

    Host: 127.0.0.1:10443
    X-Forwarded-For: 192.168.1.19
    X-Forwarded-Host: bumby2.hank.org
    X-Forwarded-Server: localhost

The Host headers is the address and port of the backend server.

Catalyst::Engine::Apache uses X-Forwarded-For to set the connecting
address

Catalyst also uses X-Forwarded-Host to extract out the host and port for
creating self-referencing URLs ($c->req->base).

And, I use the Host header to determine if the initial request was SSL
or not (by looking for /443/).

Now, with Perlbal acting as the reverse proxy in front of
mod_perl/Catalyst I see just these:


    Host: bumby2.hank.org
    X-Forwarded-For: 192.168.51.71

So, the Host: header is not the host name used to connect to the
backend, and there's no X-Forwarded-Host.

I can hard-code the headers with "HEADER <service> insert" and that
will work fine for Host, but if I have more than one host name (say
for branding or just www.example.com vs example.com) then I need to
know the actual host name supplied in the Host: header.

I can solve by modifying Catalyst::Engine::Apache, but was curious if
there was a way to make Perlbal generate headers like mod_proxy does.


-- 
Bill Moseley
moseley at hank.org



More information about the perlbal mailing list