重定向根域到www在Heroku基于主机名的SSL
问题描述:
我想重定向我的根网址:http:// [网站名称] .com上为https:// WWW [网站名称] .com上重定向根域到www在Heroku基于主机名的SSL
后端在heroku上使用主机名基本SSL进行导航。
我的域名在GoDaddy上注册。
而且,这里是我已经试过:
-
在我的ApplicationController中,我有一个名为redirect_to_https的before_filter。的,这个内容是:
def redirect_to_https puts "In Redirect" redirect_to "https://www.[sitename].com#{request.fullpath}" unless request.ssl? || !Rails.env.production? end
当我浏览到该网站的根域,我没有看到“在重定向”在日志中。所以,显然重定向实际上并不工作。
任何想法?
答
我想看看Rack-rewrite,它是一个效率更高的底层库,可以很好地完成所有这些功能。另外,推出自己:
http://www.simonecarletti.com/blog/2011/05/configuring-rails-3-https-ssl/
看跌期权不会写入日志文件。 '使用Rails.logger.info' – 2012-02-06 10:35:50
谢谢!但它实际上(如从我的代码库中的许多其他位置的日志文件中看到的) – amehta 2012-02-06 14:54:54