1
votes

I'm trying to mount a rack application to load up with my rails 2.3.12 app which uses ssl in certain controllers. Everything works just fine until I request any page that uses HTTPS, which then I get nothing more than a plain white page that says "Not Found: /some_path"

Here's what it looks like: https://skitch.com/jimmybaker/fq7js/https-fail

I'm deploying my rails app using phusion passenger + nginx + ree. I placed my config.ru file at the root of my rails application and here is what it looks like:

#!/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

As you can see, I'm trying to load up the resque-web front end for viewing jobs in my redis queue. Again, I AM able to access the resque front end, the problem is that this breaks all of the controllers that require ssl in my rails app.

1

1 Answers

1
votes

I have exactly the same thing here but I did it in a different way:

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