Skip to content
Browse files

Update Readme

  • Loading branch information...
1 parent f3495f2 commit 7917bf5469ca5c720da2a7e11597c2f86e4c4e56 Mike Fulcher committed Apr 12, 2012
Showing with 14 additions and 21 deletions.
  1. +14 −21 README.md
View
35 README.md
@@ -1,33 +1,26 @@
-Bounces or redirects requests to missing static files.
-Partially inspired by [http://menendez.com/blog/using-django-as-pass-through-image-proxy/](http://menendez.com/blog/using-django-as-pass-through-image-proxy/)
+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.
-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.
+```ruby
+gem install rack-static_fallback
+```
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/"
+Example
-in your 'config.ru' (this is untested so mileage may vary)
+```ruby
+# config/environments/development.rb
+require 'rack/static_fallback'
+config.middleware.use ::Rack::StaticFallback,
+ :mode => :fallback,
+ :static_path_regex => %r{/system/uploads},
+ :fallback_static_url => "http://myproductionsite.com/"
+```

0 comments on commit 7917bf5

Please sign in to comment.
Something went wrong with that request. Please try again.