Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将 RubyOnRails 3.1 应用程序部署到 heroku cedar 堆栈。从应用程序中,我想自动发现主机名(即appname.herokuapp.com)。我在 heroku 上部署了同一个应用程序的多个部署 - 一些用于开发,一些用于暂存,一些用于生产。如果能够检查环境变量或进行一些调用以从应用程序中找出我的应用程序主机名,那就太好了。
appname.herokuapp.com
做
request.host
给你想要的?