[Catalyst] changing the port

Octavian Rasnita orasnita at gmail.com
Sun Jan 14 16:55:28 GMT 2007


From: "Bill Moseley" <moseley at hank.org>

> That should work.  Look at C::Engine::Apache:
>
> http://dev.catalyst.perl.org/browser/trunk/Catalyst-Engine-Apache/lib/Catalyst/Engine/Apache.pm
>
>        $host = $c->request->header( 'X-Forwarded-Host' );
>
>        if ( $host =~ /^(.+):(\d+)$/ ) {
>            $host = $1;
>            $port = $2;
>        }
>
> Maybe print out that headers on your back-end Catalyst and see what
> the front end is sending to make sure the port is included.
>
> -- 
> Bill Moseley

Hi,

I have tried it, and yes, the host and port are well taken this way.
But how should I redirect automaticly to the base directory (/) including 
the port?

If I do

$c->res->redirect($c->res->base);

... it doesn't work, because it redirects to http://www.server.com/ and not 
to the port it uses.

Is there a way of doing this automaticly, or I will need to get the port 
manually as you described, then to redirect to the host + port?

Thanks.

Octavian




More information about the Catalyst mailing list