在Rails 2.3.12中安装机架应用程序,HTTPS失败



我试图安装一个机架应用程序来加载我的rails 2.3.12应用程序,该应用程序在某些控制器中使用ssl。一切工作正常,直到我请求任何使用HTTPS的页面,然后我得到的只是一个普通的白色页面,上面写着"Not Found:/some_path"

是这样的:https://skitch.com/jimmybaker/fq7js/https-fail

我正在使用fusion passenger + nginx + ree部署我的rails应用程序。我把config.ru文件放在rails应用程序的根目录下,下面是它的样子:

#!/usr/bin/env ruby
require 'logger'
require 'config/environment'
require 'resque/server'
use Rack::ShowExceptions
# Set the AUTH env variable to your basic auth password to protect Resque.
AUTH_PASSWORD = 'xxxxxxx' || ENV['AUTH']
if AUTH_PASSWORD
  Resque::Server.use Rack::Auth::Basic do |username, password|
    password == AUTH_PASSWORD
  end
end
run Rack::URLMap.new 
  '/'       => ActionController::Dispatcher.new,
  '/resque' => Resque::Server.new

正如你所看到的,我正试图加载resque-web前端来查看我的redis队列中的作业。再一次,我能够访问resque前端,问题是,这打破了所有需要ssl在我的rails应用程序的控制器。

我这里有完全相同的东西,但我用了不同的方法:

require File.dirname(__FILE__) + '/config/environment'
require 'resque/server'
Resque::Server.class_eval do
  use Rack::Auth::Basic do |username, password|
    begin
      user = User.authenticate( username, password )
      user && user.is_admin?
    rescue AuthenticatedSystem::InvalidLogin
      false
    end 
  end
end
app = Rack::Builder.new {
  use Rails::Rack::Static
  map "/resque" do
    run Resque::Server
  end
  map "/" do
    run ActionController::Dispatcher.new
  end
}.to_app
run app

相关内容

最新更新