sikachu / sprockets-redirect

A Rack middleware for Rails >= 3.1.0 with asset pipeline and asset digest enabled. This middleware is used to redirect any request to static asset without a digest to the version with digest in its filename by reading the assets manifest file generated after you run `rake assets:precompile`
http://rubygems.org/gems/sprockets-redirect
MIT License
72 stars 26 forks source link

Phusion Passenger and Apache #14

Open geneeblack opened 7 years ago

geneeblack commented 7 years ago

Attempting to use this under Passenger and Apache but it does not seem to be getting to the redirect. Any guidance on what I should look for or is this known to work/not work under these conditions? (Other Rack middleware has not had an issue but they were not doing redirects).

I have confirmed that: config.assets.digest = true config.assets.compile = false

assets are compiled and a manifest.yml exists in the default asset directory, I have confirmed that entries exist for images that are not being redirected

I am not directly setting any config options for sprockets-redirect I have not seen any logging indicating that the class was loaded/not loaded

The same configuration works great when running locally under Webrick

geneeblack commented 7 years ago

Never mind, the reason why it doesn't work with passenger is because access to the assets directory is bypassing rails.

https://www.phusionpassenger.com/library/dev/ruby/rails_integration.html#asset-pipeline

Even though it is somewhat ambiguous when it later says it only applies to Nginx, I'm sure this is what is happening based on the symptoms and the fact that I could not find any other config items in Apache that would be interfering.