Railsauthenticate_or_request_with_http_basic 不适用于 SSL + nginx
我在 Rails 3 应用程序中得到了一个操作,我正在使用authenticate_or_request_with_http_basic对其进行密码保护。在我的开发计算机上工作正常,但它不会在生产服务器上提示输入 http_basic 用户/密码。
整个生产应用程序通过 nginx 上的 https/SSL 运行。
我该去哪里解决这个问题? http 基本身份验证不能通过 SSL 工作吗?或者我需要查看 nginx 设置吗?
TIA
I've get an action in my Rails 3 app that I'm pw-protecting with authenticate_or_request_with_http_basic. Working fine on my development machine but it's not prompting for the http_basic user/password on the production server.
The entire production app runs over https/SSL on nginx.
Where do I look to resolve this? Does http basic auth not work over SSL? Or is there an nginx setting I need to look at?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定这是否与 Rails 3 有关。
我最近在运行 Mongrel 1.1.5 和 Rails 2.3.8 时遇到问题
显然,此设置中存在一个错误,我们的生产计算机不会提示输入用户名和密码(但可以使用)本地,因为我们使用的是 web-brick)。
在 mongrel.log 中,我们不断收到此错误:
Error Calling Dispatcher.dispatch #split' Called for nil
:无类>
/usr/local/rvm/gems/ruby-1.8.7-p174/gems/actionpack-2.3.8/lib/action_controller/cgi_process.rb:52:indispatch_cgi'
/usr/local/rvm/gems/ruby-1.8.7-p174/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:101:在`dispatch_cgi'中
...
找到了修复这个 Mongrel 1.1.5 和 Rails 2.3.8 所需的猴子补丁,它对我有用。
提供解决方案的德国站点:http://railssprech.de/,其中有 2.3.8 和 2.3 的 2 个链接.9.
这是 2.3.8 版本: http://www.pcoder.net/ error-calling-dispatcher-dispatch/#axzz1RknBQso2
该补丁解释了发生此错误的原因。检查 Rails 3 CGIHandler.dispatch_cgi 方法并查看是否有相同的错误。您可能需要提取 Rails 3 并对其进行猴子修补。
希望这有帮助。
顺便说一句:Mongrel 1.1.5 和 Rails 2.3.5 可以工作!
Not sure if this related to Rails 3.
I just recently had problems running Mongrel 1.1.5 and Rails 2.3.8
Apparently, there is a bug in this set up where our production machine does not prompt for the user name and password (but works locally, because we are using web-brick).
In the mongrel.log we keep getting this error:
Error calling Dispatcher.dispatch #split' called for nil
:NilClass>
/usr/local/rvm/gems/ruby-1.8.7-p174/gems/actionpack-2.3.8/lib/action_controller/cgi_process.rb:52:indispatch_cgi'
/usr/local/rvm/gems/ruby-1.8.7-p174/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
...
Found the monkey patch needed to fix this Mongrel 1.1.5 and Rails 2.3.8 and it worked for me.
The german site that lead to the solution: http://railssprech.de/ with 2 links for 2.3.8 and 2.3.9.
Here is the 2.3.8 version: http://www.pcoder.net/error-calling-dispatcher-dispatch/#axzz1RknBQso2
The patch explains why this error was occurring. Check the Rails 3 CGIHandler.dispatch_cgi method and see if it the same bug. You may need to extract the Rails 3 out and monkey patch it.
Hope this helps.
BTW: Mongrel 1.1.5 and Rails 2.3.5 works!