Improve support for non-standard domain names

Hey, guys. Can you provide a feedback for patch
https://rails.lighthouseapp.com/projects/8994/tickets/6196-patch-improve-support-for-non-standard-domain-names