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

Charlie Garrison garrison at zeta.org.au
Tue Aug 28 11:34:16 GMT 2007


Good evening,

I upgraded Catalyst-Runtime from 5.7007 to 5.7010 yesterday; and 
that seems to be the cause of this problem. But it could have 
been there before and it was never reported by our users.

When users try to login <https://www.resultsplus.com.au/progs/>, 
the following error is returned:

     Bad Request
     Your browser sent a request that this server could not understand.
     Client sent malformed Host header
     Apache/1.3.29 Server at www.resultsplus.com.au:443:8627 
Port 443

Catalyst is doing a redirect to the login page using:

     $c->response->redirect($c->uri_for('/login'));

As far as I can tell, that is when :443 is being added to the URL.

The above error makes sense in the context of frontend/backend 
apache with rewrite rules.

     RewriteRule ^/login(.*)$    
http://%{HTTP_HOST}:8627/progs/login$1 [P]
     RewriteRule ^/progs/(.*)$   
http://%{HTTP_HOST}:8627/progs/$1 [P]

I'm redirecting to and using different ports on the backend to 
identify secure connections, and then setting ENV as:

     PerlSetEnv HTTPS "on"

So, assuming I'm reaching the correct conclusion (that uri_for 
is the culprit), how do I prevent it from adding :443 to the URL?

I've fixed it temporarily using a rewrite rule with hard-coded 
value in place of %{HTTP_HOST}, but the :443 port is being added 
to every URL created with uri_for throughout the site.

I've had a look at Catalyst::uri_for sub and it seems to be 
getting the 'base' from the URI object. But I'm running short of 
debug fu and would appreciate some assistance at this point.

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