I have a simple Rails app deployed to the Heroku Cedar stack.
The app uses Resque and the Resque Sinatra front-end app is mounted so I can monitor the queue:
# routes.rb
...
mount Resque::Server, :at => "/resque"
This works great, but when deployed to Heroku, the Resque front-end's CSS & JavaScript are not being served.
A snippet of Heroku's logs indicates it's returning zero bytes:
...
2011-07-13T16:19:35+00:00 heroku[router]: GET myapp.herokuapp.com/resque/style.css dyno=web.1 queue=0 wait=0ms service=3ms status=200 bytes=0
2011-07-13T16:19:35+00:00 app[web.1]:
2011-07-13T16:19:35+00:00 app[web.1]:
2011-07-13T16:19:35+00:00 app[web.1]: Started GET "/resque/style.css" for 87.xx.xx.xx at 2011-07-13 16:19:35 +0000
2011-07-13T16:19:35+00:00 app[web.1]: cache: [GET /resque/style.css] miss
How can I get it to serve these assets?
Try removing the route and mounting the app in your config.ru
. I'm using something along the lines of:
require ::File.expand_path('../config/environment', __FILE__)
require 'resque/server'
run Rack::URLMap.new(
"/" => Rails.application,
"/resque" => Resque::Server.new
)
Same as ezkl but password protected, works for me:
# config.ru
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
require 'resque/server'
# Set the AUTH env variable to your basic auth password to protect Resque.
AUTH_PASSWORD = ENV['RESQUE_PASSWORD']
if AUTH_PASSWORD
Resque::Server.use Rack::Auth::Basic do |username, password|
password == AUTH_PASSWORD
end
end
run Rack::URLMap.new \
'/' => MyApp::Application,
'/resque' => Resque::Server.new
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With