Bounces or redirects requests to missing static files. Partially inspired by http://menendez.com/blog/using-django-as-pass-through-image-proxy/
I.e. could be useful when you want to run the server with production database locally and have user uploaded content fetched transparently from production site.
Options:
:mode - [ :off,
:bounce, # returns 404 to any request to static URL,
:fallback ] # any request to static path is redirected to :fallback_static_url
:static_path_regex - Regexp which matches the path to your static files.
Along the lines of the Capistrano conventions defaults to %r{/system/(audios|photos|videos)}
:fallback_static_url - URL of the production site
Install via rubygems:
gem install rack-static_fallback
then, for Rails (any version which supports Rack) apps, add the following to your 'config/environments/development.rb'
require 'rack/static_fallback'
config.middleware.insert_after ::Rack::Lock,
::Rack::StaticFallback, :mode => :fallback,
:static_path_regex => %r{/system/uploads},
:fallback_static_url => "http://myproductionsite.com/"
Aternatively, you should also be able to use the gem in Rack apps with:
use ::Rack::StaticFallback, :mode => :fallback,
:static_path_regex => %r{/system/uploads},
:fallback_static_url => "http://myproductionsite.com/"
in your 'config.ru' (this is untested so mileage may vary)