title: What's the best way to get the hostname from the env hash in a Rails app?
body: <p>I'm writing an <a href="https://github.com/intridea/omniauth/wiki/Dynamic-Providers" rel="nofollow">OmniAuth dynamic provider</a> and in the callback I need to get the current hostname (the app works in several different hostnames). I don't have the request object, just a big env hash. I found this hash contains an entry, env["SERVER_NAME"], with the hostname, but I'm not sure if that's a stable entry or it may change depending on the web server or stuff like that.</p>
  
  <p>I also found the hostname buried in env["action_dispatch.routes"] in the member variable @host.</p>
  
  <p>Any ideas what's the best or canonical way to get the hostname at this point?</p>