README.md in rack-mogilefs-0.1.3 vs README.md in rack-mogilefs-0.2.0
- old
+ new
@@ -1,9 +1,36 @@
# rack-mogilefs
If you are using Nginx you'll probably want to serve MogileFS files with
the [MogileFS Module](http://www.grid.net.ru/nginx/mogilefs.en.html), but if
-you need to serve them out of a Rack app, this should help.
+you need a quick way to serve them out of a Rack app, this should help.
+
+## Caveats ( serving files vs reproxying )
+
+Serving files through Ruby is slow. The preferred method is to set an
+X-Reproxy-Url header from your app and let the web server serve the file. For
+Nginx, you could have a config like this:
+
+ location /reproxy {
+ internal;
+ set $reproxy $upstream_http_x_reproxy_url;
+ proxy_pass $reproxy;
+ proxy_hide_header Content-Type;
+ }
+
+For Apache, there is [mod_reproxy](http://github.com/jamis/mod_reproxy)
+
+`Rack::MogileFS` will use this method if you pass a strategy option of `:reproxy`
+
+ use Rack::MogileFS, :strategy => :reproxy
+
+`Rack::MogileFS` will look up the internal urls for the file, and set two
+headers to reproxy the request:
+
+ X-Accel-Redirect: /reproxy
+ X-Reproxy-Url: http://internal.ip/path/to/mogile/file.fid
+
+You'll have to make sure your web server knows how to handle this request.
## Getting Started:
First install the gem: