Ruby Rails子域不工作

Ruby Rails子域不工作,ruby,ruby-on-rails-3,subdomain,Ruby,Ruby On Rails 3,Subdomain,我已经修改了etc/hosts,将app.website.local映射到我的localhost 127.0.0.1。这是可行的,它被重定向到我的本地主机 问题是request.subdomain是空的,所以我不能对它做任何事情 class ApplicationController before_filter :ensure_domain private def ensure_domain # do something with the request #

我已经修改了etc/hosts,将app.website.local映射到我的localhost 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
我的etc/主持人:

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

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

config.action_dispatch.tld_length = 3

删除这一行就解决了这个问题

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

config.action_dispatch.tld_length = 3
删除这一行就解决了这个问题