The optimizations introduced in #9450 and committed in [7421] (and friends) break named routes when you're specifying :host. For example:
map.foo 'foo' :controller => 'foo', :action => 'bar', :host => 'www.foo.bar'
foo_url #=> 'http://localhost:3000/foo'
foo_url(:a => 1) #=> 'http://www.foo.bar/foo?a=1
I'm attaching a patch that fixes the issue, but I'm not sure how to update the routing tests to prove the benefit - as far as I can tell, the optimized routes aren't being properly tested now, due to some of the changes introduced in response to problems people say with default_url_options and the like (check the comments in #9450)