3

带有 redirect_to 的 Rails 3 应用程序正在丢失斜杠,因此“/test.com/foo”正在重定向到“ https://test.comfoo

class ApplicationController < ActionController::Base
before_filter :switch_to_ssl
def switch_to_ssl
  if ENV['RAILS_ENV']=="production" && !request.ssl?
        redirect_to :protocol=>"https://"
      end
end

有任何想法吗?

4

0 回答 0