gpt4 book ai didi

ruby-on-rails-3 - 尝试通过 routes.rb 强制 SSL 后,我的登录路由不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 12:54:15 25 4
gpt4 key购买 nike

我希望人们能够通过 SSL 订阅和登录我的应用程序。我的原始路由(不是 SSL)是这样的:

resource :login, controller: "sessions" do
collection do
get 'new'
get 'create'
end
end

效果很好,但未加密。然后我试了这个:

scope :protocol => 'https://', :constraints => { :protocol => 'https://' } do
resource :login, controller: "sessions" do
collection do
get 'new'
get 'create'
end
end
end

现在 Rails 我:

No route matches [GET] "/login"

当我导航到 https://myapp.dev/login

请注意我在开发模式下使用 Pow。

最佳答案

嗯,我还以为会这样呢

  scope :constraints => { :protocol => "https" } do 
resource :login, controller: "sessions" do
collection do
get 'new'
get 'create'
end
end
end

你可以根据需要在下面放置更多资源条目

关于ruby-on-rails-3 - 尝试通过 routes.rb 强制 SSL 后,我的登录路由不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15954608/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com