【发布时间】:2013-12-23 06:38:12
【问题描述】:
我有一个 Rails 应用程序,其中我使用 force_ssl 方法
def force_ssl # to use https for payment page
if !Rails.env.development? && !request.ssl?
redirect_to :protocol => 'https'
end
end
对于带有命名路由的特定动作名称“abc”
match '/find-a-abc' => "home#abc"
当我转到 URL 时
http://local.demo.com/find-a-abc
它会重定向到https://local.demo.com/abc
任何解决方案?所以它会redirect_to特定的路由,而不是在使用https协议时重定向到一个Action。
【问题讨论】:
-
将
force_ssl定义为before_filter工作吗? -
是的,它工作得很好,但我的问题是它重定向到操作而不是命名路径。
标签: ruby-on-rails-3 redirect https