Apache + Passenger + Rails not serving assets after adding SSL certificate

By | January 12, 2018
Questions:

My Rails server has been working fine until adding an SSL certificate and using force_ssl, to the point where it will neither fully validate (says the site is only partially encrypted), nor load any assets. All that loads is a static html page – with working links, but that’s just about it.

Has anyone ever run into this problem before?

UPDATE

This is the stack trace I’ve been getting in production.log (there are several, this is just an example of one for a single request)

Started GET "/internal-nginx-static-locationassets/slide2.png" for 129.21.79.202 at 2012-07-24 10:18:39 -0700

ActionController::RoutingError (No route matches [GET] "/internal-nginx-static-locationassets/slide2.png"):
  vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/rack/logger.rb:26:in `call_app'
  vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/rack/logger.rb:16:in `call'
  vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/request_id.rb:22:in `call'
  vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
  vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
  vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
  vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
  vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
  vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
  vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
  vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
  vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:479:in `call'
  vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:220:in `call'
  vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `block in handle_spawn_application'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/utils.rb:470:in `safe_fork'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb:180:in `start'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb:219:in `block (2 levels) in spawn_rails_application'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb:214:in `block in spawn_rails_application'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
  <internal:prelude>:10:in `synchronize'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/helper-scripts/passenger-spawn-server:99:in `<main>'
Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *