0

我已经成功地与乘客一起部署了我的 Rails 应用程序。但是,我的 redirect_to 在生产环境中的行为与开发环境不同。

我有这个代码:

redirect_to( :page => :signup, :subdomain => false)

在开发应用程序上它工作得很好,所以:

http://demo.charterbox.com.au重定向到http://charterbox.com.au/?page=signup完美!

在我刚刚上传的生产应用程序中,它执行以下操作:

http://demo.charterbox.com.au重定向到http://com.au/?page=signup

它不仅带走了子域,还带走了整个域。不管我是否使用子域,它仍然会重定向到http://.com.au

以下是 ApplicationsController 中的完整代码:

before_filter :check_domain

def check_domain

  if request.subdomain.blank? == false
     @account = Account.where("site_address = ?", request.subdomain).limit(1)      
     if @account.empty? 
       redirect_to( :page => :signup, :subdomain => false)
     end
  end

end 

有什么建议么?

4

1 回答 1

0

您需要配置 TLD 长度。

config.action_dispatch.tld_length sets the TLD (top-level domain) length for the application. Defaults to 1.

http://guides.rubyonrails.org/configuring.html#configuring-action-dispatch

于 2013-01-29T00:35:05.510 回答