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

Matt S Trout dbix-class at trout.me.uk
Mon Sep 3 19:54:38 GMT 2007


On Tue, Aug 28, 2007 at 08:34:16PM +1000, Charlie Garrison wrote:
> 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]

That's kinda broken, it's relying on the request header which a browser
could easily cock up.

I suspect %{REMOTE_HOST} would be better (see the mod_rewrite docs for
more info)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/                    http://www.shadowcat.co.uk/ 



More information about the Catalyst mailing list