[Catalyst] Anyone using ProxyPass?

Richard Jones ra.jones at dpw.clara.co.uk
Mon Jul 2 19:46:41 GMT 2007


Bill Moseley wrote:
> On Sat, Jun 30, 2007 at 11:56:44AM +0100, Richard Jones wrote:

> You should not need to use ProxyPassReverse is using $c->uri_for for
>  redirects.
OK, but I'm using uri_for in the templates to construct the URLs. Does
that amount to the same thing? I removed ProxyPassReverse from Apache's 
config but it hasn't changed behaviour.

>> However, the URLs constructed in the templates from 
>> Catalyst.uri_for pick up the port number, thus defeating the idea 
>> of ProxyPass.
> 
> You mean uri_for is generating links showing the port of the back end
>  Catalyst server?
Yes, Apache on port 80 is ProxyPass'ing /myapp to
http://127.0.0.1:81/myapp. The URLS on first login are
http://127.0.0.1:81/myapp/register, http://127.0.0.1:81/myapp/search, etc.

> Catalyst::Engine::Apache looks at X-Forwarded-Host header to set the 
> host and port for the request object:
> 
> $host = $c->request->header( 'X-Forwarded-Host' );
> 
> if ( $host =~ /^(.+):(\d+)$/ ) { $host = $1; $port = $2;
> 
> Which ends up setting the request base, which is used in uri_for.
$c->log->info( Dumper $c->request->header( 'X-Forwarded-Host' ) ) in a
controller dumps an empty string. Is this correct?

> Is your front end machine on the same host? If not you would likely 
> need to set $c->config->{using_frontend_proxy} per the docs.
Yes, both Apache servers (:80 and :81) are on the same host. I've still
no idea what is wrong here.
-- 
Richard Jones
Leeds, UK
mailto:ra.jones at dpw.clara.co.uk



More information about the Catalyst mailing list