Heroku cedar、Rails 3.1rc6、子域路由
在本地,在 Unicorn 上,我的子域设置工作正常。我严格遵循 heroku 子域文档,以及子域 Railscast。 subdomain.lvh.me:3000 指向正确的位置,lvh.me:3000 正确指向在routes.rb 中定义的根:
root :to => "pages#home"
但是,在 Heroku 的 Cedar 堆栈上的新暂存部署中,再次使用 Unicorn,而 subdomain.mydomain .co.uk 指向正确的位置,而 mydomain.co.uk 则不然。它不是按照路由文件访问pages#home,而是访问书籍控制器,只有在url中有子域时才会这样做,按照routes.rb:
constraints(Subdomain) do
match '/' => 'books#show'
end
我的DNS设置是按照Heroku文档,并且主机命令返回文档所说的内容。有什么想法吗?
Locally, on Unicorn, my subdomain setup works fine. I've followed the heroku subdomain docs to the letter, and also the subdomains Railscast. subdomain.lvh.me:3000 points to the right place, and lvh.me:3000 points correctly to the root defined in routes.rb:
root :to => "pages#home"
However, in my new staging deployment on Heroku's Cedar stack, again using Unicorn, whilst subdomain.mydomain.co.uk points to the right place, mydomain.co.uk doesn't. Instead of going to pages#home as per the routes file, it's hitting the books controller, which it's only meant to do if there's a subdomain in the url, as per routes.rb:
constraints(Subdomain) do
match '/' => 'books#show'
end
My DNS settings are as per the Heroku docs, and the host command returns what the docs say it should. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将别名域添加到 subdomain.rb:
Add the aliased domain to subdomain.rb: