[Catalyst] Setting $c->req->{base}

Andy Grundman andy at hybridized.org
Tue Sep 20 15:14:31 CEST 2005


Alessio Bragadini wrote:
> On Mon, 2005-09-19 at 17:09 -0400, Andy Grundman wrote:
> 
> 
>>I think the solution is to check the variable HTTP_X_FORWARDED_HOST (or 
>>maybe _SERVER) which on my double-Apache setup appears to contain the 
>>frontend hostname.
> 
> 
> I don't think it's the best solution, because it addresses a specific
> case of a more general problem. For example it doesn't handle the case
> where the server on front host runs on yet another port - or it's
> running https. The flexible solution IMHO is to add a "base"
> configuration option to check against, users who need it will know what
> to put there.

I would recommend if you need to set base to something specific, that 
you just do this in your App's begin() method:

$c->req->base( 'http://whatever/' );

I don't think running the frontend on another port will make a 
difference as the code only checks the address.  HTTPS though, good 
point.  That will need to be handled as well.

-Andy



More information about the Catalyst mailing list