上周我尝试在 webbrick 中激活 SSL 进行调试,但我忘记了如何将设置恢复为默认设置(没有 SSL)。每次我访问控制器时,现在它都会显示:
SSL 连接错误
无法与服务器建立安全连接。这可能是服务器的问题,或者可能需要您没有的客户端身份验证证书。
错误 107 (net::ERR_SSL_PROTOCOL_ERROR):SSL 协议错误。
下面是控制台的日志,有人可以帮忙吗?
[2011-05-10 07:28:43] 信息 WEBrick 1.3.1
[2011-05-10 07:28:43] INFO ruby 1.8.7 (2009-06-12) [universal-darwin10.0]
[2011-05-10 07:28:43] 信息 WEBrick::HTTPServer#start: pid=62854 端口=3000
[2011-05-10 07:28:58] 错误错误请求行`UQM?x?ʾ??????c??B??????n???BU???*?? ?98?5EDf32?A/??'。
Last week I tried to debug with SSL activated in webbrick, but I forget how to restore the settings to default(without SSL). Every time I visit a controller, now it shows:
SSL connection error
Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.
Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
And below is the log from the console, can anyone help?
[2011-05-10 07:28:43] INFO WEBrick 1.3.1
[2011-05-10 07:28:43] INFO ruby 1.8.7 (2009-06-12) [universal-darwin10.0]
[2011-05-10 07:28:43] INFO WEBrick::HTTPServer#start: pid=62854 port=3000
[2011-05-10 07:28:58] ERROR bad Request-Line `UQM?x?ʾ???????c??B?????n???BU???*???98?5EDf32?A/??'.
发布评论
评论(5)
我今天刚刚遇到了同样的问题。我将 config.force_ssl = true 添加到 application.rb 文件并收到上述错误。当我删除该行时,错误仍然存在。
我通过清除浏览器 cookie(本例中为 Chrome)修复了该问题,然后它又可以工作了。看来身份验证信息保存在 cookie 中,并且我不断将我们的请求恢复为 HTTPS,但未正确进行身份验证,因此您会收到该错误。清除 cookie 可以解决该问题。
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.
我遇到了类似的问题,但无法通过清除 Chrome 上的 cookie 来修复它(也没有任何其他修复,例如
rake tmp:clear
),最终切换到使用启用 SSL 的 Thin,如建议的那样这篇文章:https://stackoverflow.com/a/11614213
将其添加到我的 Gemfile 中:
然后
bundle
和精简启动--ssl
。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:
Then
bundle
andthin start --ssl
.我必须使用
rake tmp:sessions:clear
(不仅仅是rake:tmp:clear
)以及清除浏览器中的cookie来解决这个问题。I had to use
rake tmp:sessions:clear
(not justrake:tmp:clear
) as well as clearing cookies in the browser to fix this issue.打开Chrome开发者工具,点击并按住“页面重新加载”按钮,你会看到一些选项,选择“清空缓存和硬重新加载”。为我做了这个伎俩。
Open Chrome Developer Tools, click and hold "page reload" button, you will see some options,pick "Empty Cache and Hard Reload". Did the trick for me.
同样,在 config/locales/application.rb 文件中添加 config.force_ssl = true 后,我收到了相同的错误
要修复 SSL 错误,只需编辑 Rails.application.config.session_store :cookie_store , key: '_app_sessions' in config/initializers/session_store.rb
将
'_app_sessions'
名称更改为其他名称将允许您在没有 ssl 的情况下启动 Rails 服务器,并且不会出现错误Similarly I recieved the same error after adding
config.force_ssl = true
in my config/locales/application.rb fileTo remedy an SSL error, simply edit
Rails.application.config.session_store :cookie_store, key: '_app_sessions'
in config/initializers/session_store.rbChanging the
'_app_sessions'
name to anything else will allow you to start your rails server without ssl and without error