[Catalyst] Anyone using ProxyPass?

Bill Moseley moseley at hank.org
Tue Jul 3 16:21:44 GMT 2007


On Tue, Jul 03, 2007 at 11:24:34AM +0100, Richard Jones wrote:
> 1) There is definitely no $c->request->header('X-Forwarded-Host')

Check if you have X-Forwarded-For.


Let's see, I have not looked at this in a while but in apache2 I have:

    LoadModule proxy_module         /usr/lib/apache2/modules/mod_proxy.so
    LoadModule proxy_http_module    /usr/lib/apache2/modules/mod_proxy_http.so

    ProxyVia            On
    ProxyReceiveBufferSize 16384

I guess I'm using mod_rewrite to figure out what does or doesn't need
to be sent to the back end -- so after all my rewrite rules and
conditions I have:

        # Proxy everything else
        RewriteRule (.+) http://127.0.0.1:10085$1 [proxy]

After that I guess you are stuck figuring out why you are not getting
that header.



> 2) In Catalyst::Engine::Apache::prepare_path, $host = the IP address of
> the server (not localhost or 127.0.0.1), and $port = 81.

Did you see this code?

    PROXY_CHECK:
    {
        my $headers = $self->apache->headers_in;
        unless ( $c->config->{using_frontend_proxy} ) {
            last PROXY_CHECK if $c->request->address ne '127.0.0.1';
            last PROXY_CHECK if $c->config->{ignore_frontend_proxy};
        }
        last PROXY_CHECK unless $headers->{'X-Forwarded-For'};

        # If we are running as a backend server, the user will always appear
        # as 127.0.0.1. Select the most recent upstream IP (last in the list)
        my ($ip) = $headers->{'X-Forwarded-For'} =~ /([^,\s]+)$/;
        $c->request->address( $ip );
    }

If your address isn't 127.0.0.1 then it's not going to check for a
proxy unless "using_frontend_proxy" is set.

-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list