Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Bounces or redirects requests to missing static files

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Bounces or redirects requests to missing static files, allowing you to run a local server with a production database and have user uploaded content fetched transparently from the production site.

gem install rack-static_fallback


: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


# config/environments/development.rb
require 'rack/static_fallback'
config.middleware.use ::Rack::StaticFallback,
  :mode => :fallback,
  :static_path_regex => %r{/system/uploads},
  :fallback_static_url => ""
Something went wrong with that request. Please try again.