setting up ssl on devise

2019-03-09 20:28发布

I'd like to require ssl authentication for the user resource on devise. I was expecting that to be as simple as it is in rails, like:

  devise_for :users, :constraints => { :protocol => "https" }

Also, I couldn't find any documentation on devise's github, though I've found some dead links pointing to it at the google groups.

Does anybody has a hint on how to get it working easily? I thought I'd be simple, given the popularity of the plugin

4条回答
贼婆χ
2楼-- · 2019-03-09 21:19

Integrate SSL Requirement into your app and using Devise. The answer didn't work but this did for me, especially since I was using SSL Requirement already.

查看更多
ゆ 、 Hurt°
4楼-- · 2019-03-09 21:26

I suggest using Rack::SSL, maybe with Rack::SslEnforcer for more configuration options.

查看更多
走好不送
5楼-- · 2019-03-09 21:27

:constraints won't work as option, but this probably will:

constraints :protocol => "https" do
  devise_for :users
end
查看更多
登录 后发表回答