[Catalyst] uri_for adding :443 to URL when HTTPS=on

Charlie Garrison garrison at zeta.org.au
Tue Sep 4 18:08:31 GMT 2007


Good morning,

On 4/9/07 at 4:44 PM +0100, Matt S Trout 
<dbix-class at trout.me.uk> wrote:

>>  REMOTE_HOST seems to be the client host name, not the 
>>server. So  I don't think that's the one you meant. Did you 
>>mean SERVER_NAME  instead? Since SERVER_NAME seems to give the 
>>value I expect,  I'll switch to using that.
>
>Damn. Yes, sorry.
>
>Rewrite setup configs always fall out of my head if I don't do one for a
>few days.

Or even a few hours for some of us.  ;-)

>>  Still doesn't really solve the core  issue though.
>
>I thought the core issue was that your rewrite rules were broken?

Sorry for not being clear. I was giving that info as background 
and to show how I was working around the issue.

>>  When I generate a URI string with $c->uri_for(...) and 
>>HTTPS=on,  then I get :443 as part of the URI string. What can 
>>I do in my  Catalyst config (or elsewhere) to prevent :443 
>>being included in  the URI string?
>
>Have you checked to see what your webserver's giving Catalyst? I'm not
>sure this isn't just uri_for naively working with what the webserver gives
>it.

To confirm, I'm using a rewrite rule such as:

     # uses custom port on backend to indicate https - sets HTTPS=on
     # Catalyst app base is /progs
     RewriteRule ^/progs/(.*)$   
http://%{SERVER_NAME}:8627/progs/$1 [P]

I'm printing this to error_log (request for https://www.resultsplus.com.au/progs/):

INFO - ***Root::auto HTTPS: on
INFO - ***Root::auto HTTP_HOST: www.resultsplus.com.au:8627
INFO - ***Root::auto c->req->path:
INFO - ***Root::auto c->req->secure: 1
INFO - ***Root::auto c->req->base: https://www.resultsplus.com.au:443/progs/
INFO - ***Root::auto c->req->uri: https://www.resultsplus.com.au:443/progs/
INFO - ***Root::auto c->req->uri->scheme: https
INFO - ***Root::auto c->req->uri->opaque: //www.resultsplus.com.au:443/progs/
INFO - ***Root::auto c->req->uri->port: 443
INFO - ***Root::auto c->req->uri->host_port: www.resultsplus.com.au:443
INFO - ***Root::auto c->uri_for: https://www.resultsplus.com.au:443/progs/

I believe this is an issue with the URI module adding port 443 
since the port in the request is not the 'standard' https port. 
Assuming that is accurate, what is the correct way in Catalyst 
to 'correct' the URI value? Is it a bug or something I need to 
be doing differently?

Thanks,
Charlie

-- 
    Charlie Garrison  <garrison at zeta.org.au>
    PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt



More information about the Catalyst mailing list