[Catalyst] hostname

Jason Kohles email at jasonkohles.com
Wed Jan 9 17:50:27 GMT 2008


On Jan 9, 2008, at 6:16 AM, Octavian Rasnita wrote:

> Is it possible to get the host name in MyApp.pm just like I can do  
> it in a controller using
>
> $c->req->hostname;
>>
>> I want to use the current hostname for setting the cookie in the  
>> session, and the site could be accessed with 2 or more different  
>> host names. If I hard-code a certain hostname, the login won't work  
>> on other host names.

$c->req->hostname doesn't return the server hostname, it returns the  
client hostname.

> Can't the current host that was requested be accessed in MyApp.pm?
>

$c->req->header( 'Host' );

-- 
Jason Kohles, RHCA RHCDS RHCE
email at jasonkohles.com - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire





More information about the Catalyst mailing list