[Catalyst] changing the port

Octavian Rasnita orasnita at gmail.com
Sun Jan 14 09:28:54 GMT 2007


Hi all,

I have made an application that I use with mod_perl on a  back-end server on 
port 83, and the front-end server is an Apache proxy that listens on port 
8080 for the moment, and after testing I want to change it to port 80.

The application works, but at a certain moment I need to make an external 
redirection using $c->res->redirect and in this case, I don't know how to 
make a correct redirection that works no matter the ports I use.

I am accessing the url
http://www.server-name.com:8080/details/deep

and it should redirect to the main directory (/):
http://www.server-name.com:8080/

I have tried:

$c->res->redirect($c->uri_for("/"));
and
$c->res->redirect($c->res->base);

But both methods redirect to:
http://www.server-name.com/

(To the port 80 instead of 8080).

I have used dump_info=1 to see where appears the port 8080, and I have seen 
that it appears only in the following request header:

x-forwarded-host

I think I could get the port number from this request header, but in that 
case it would work only if I use the application with a proxy server.

Is there a recommended method to get the correct port of the original 
request that works no matter if the application runs using a proxy server or 
not?

Thank you very much.

Octavian




More information about the Catalyst mailing list