【问题标题】:Rails authenticate_or_request_with_http_basic not working on SSL + NginxRails authenticate_or_request_with_http_basic 在 SSL + Nginx 上不起作用
【发布时间】:2011-08-05 20:22:17
【问题描述】:

我的 Rails 3 应用程序中有一个操作,我正在使用 authenticate_or_request_with_http_basic 进行密码保护。在我的开发机器上工作正常,但它没有在生产服务器上提示输入 http_basic 用户/密码。

整个生产应用程序通过 nginx 上的 https/SSL 运行。

我在哪里可以解决这个问题? http 基本身份验证不能通过 SSL 工作吗?或者是否有我需要查看的 nginx 设置?

TIA

【问题讨论】:

    标签: ruby-on-rails authentication https nginx


    【解决方案1】:

    不确定这是否与 Rails 3 有关。

    我最近在运行 Mongrel 1.1.5 和 Rails 2.3.8 时遇到了问题

    显然,这个设置中有一个错误,我们的生产机器不提示输入用户名和密码(但在本地工作,因为我们使用的是 web-brick)。

    在 mongrel.log 中,我们不断收到此错误:

    调用 Dispatcher.dispatch #split 时出错,要求为 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:in `dispatch_cgi' ...

    找到修复这个 Mongrel 1.1.5 和 Rails 2.3.8 所需的猴子补丁,它对我有用。 导致解决方案的德国站点:http://railssprech.de/,带有 2.3.8 和 2.3.9 的 2 个链接。

    这里是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 有效!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多