[英]Mounting a rack application in Rails 2.3.12 and HTTPS failing
I'm trying to mount a rack application to load up with my rails 2.3.12 app which uses ssl in certain controllers.我正在尝试安装一个机架应用程序以加载我的 rails 2.3.12 应用程序,该应用程序在某些控制器中使用 ssl。 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"
一切正常,直到我请求任何使用 HTTPS 的页面,然后我得到的只是一个简单的白色页面,上面写着“未找到:/some_path”
Here's what it looks like: https://skitch.com/jimmybaker/fq7js/https-fail这是它的样子: https://skitch.com/jimmybaker/fq7js/https-fail
I'm deploying my rails app using phusion passenger + nginx + ree.我正在使用 phusion 乘客 + nginx + ree 部署我的 Rails 应用程序。 I placed my config.ru file at the root of my rails application and here is what it looks like:
我将我的 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
As you can see, I'm trying to load up the resque-web front end for viewing jobs in my redis queue.如您所见,我正在尝试加载 resque-web 前端以查看 redis 队列中的作业。 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.
同样,我能够访问 resque 前端,问题是这会破坏我的 rails 应用程序中所有需要 ssl 的控制器。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.