'X-Sendfile' for Rack, take 2
In the spirit of “Fork me if you like me" I forked the Rack project on github and applied my ‘X-Sendfile’ related changes. Now you can have download acceleration with:
use Rack::Static, :urls => ["/files"], :root => "public", :extra => { 'X-Sendfile' => 'yes' }
I just made a small change to pass the :extra parameter down to Rack::File and adding ‘X-Sendfile’ related headers for nginx, apache and lighttpd. :extra parameter can also contain others, non x-sendfile related headers (like cache-control etc.):
use Rack::Static, :urls => ["/css","/images"], :root => "public", :extra => { 'Cache-Control' => 'max-age=86400, public', 'Expires' => (Time.now + 86400).utc.rfc2822 }
I also added some examples for rackup and middleware to the examples/ directory. Merged the josh’s daemonize fork too, but today (11-May-2008) it was merged to the master branch.