I'm looking to use ActionDispatch::Static
to serve static files in a directory other than public. It works perfectly in development, but I can't seem to get the same results in production.
I have my static files in /var/www/mysite.com-static
. In an initializer, I've added the following:
Rails.application.config.middleware.insert_after Rack::SendFile, ActionDispatch::Static, '/var/www/mysite.com-static'
The output of rake middleware
is as follows:
use Raven::Rack
use Rack::Sendfile
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000005e61130>
use Rack::Runtime
...
Why do I get 404s on every page I request within /var/www/myapp.com-static?