How to use deactivate Webrick's SSL

 ̄綄美尐妖づ 提交于 2019-11-28 06:54:10

I just ran into this same exact problem today. I added config.force_ssl = true to the application.rb file and got the above error. When I removed the line, the error still persisted.

I fixed it by clearing my browser cookies (Chrome in this case) and it works again. It seems the authentication information is saved in the cookie and something i that keeps reverting our requests to HTTPS but does not authenticate correctly so you get that error. Clearing the cookie solves that issue.

natebeaty

I had a similar issue but wasn't able to fix it by clearing cookies on Chrome (nor any other fixes like rake tmp:clear), and ended up switching to using thin with SSL enabled as suggested in this post:

https://stackoverflow.com/a/11614213

Added this to my Gemfile:

group :development do
   gem "thin"
end

Then bundle and thin start --ssl.

I had to use rake tmp:sessions:clear (not just rake:tmp:clear) as well as clearing cookies in the browser to fix this issue.

Similarly I recieved the same error after adding config.force_ssl = true in my config/locales/application.rb file

To remedy an SSL error, simply edit Rails.application.config.session_store :cookie_store, key: '_app_sessions' in config/initializers/session_store.rb

Changing the '_app_sessions' name to anything else will allow you to start your rails server without ssl and without error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!