1

我已修改 etc/hosts 以将 app.website.local 映射到我的本地主机 127.0.0.1。这有效,它被重定向到我的本地主机。

问题是它request.subdomain是空的,所以我不能用它做任何事情。

class ApplicationController
  before_filter :ensure_domain

  private 

  def ensure_domain
    # do something with the request 
    # here is request.subdomain empty
  end
end

我的等/主机:

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0 localhost
127.0.0.1 app.website.local
4

1 回答 1

1

好的,我自己解决了这个问题。我接受了英国某人的这个项目。他们在那里使用 co.uk 作为域名。他在 development.rb 中添加了以下配置

config.action_dispatch.tld_length = 3

删除此行解决了它。

于 2013-09-29T15:44:44.097 回答