Permalink
Browse files

use nginx to send files

  • Loading branch information...
1 parent d6a1446 commit 323a029010ed9c3f79dc2934c530cbaa239ab590 @benprew committed Apr 9, 2012
Showing with 7 additions and 0 deletions.
  1. +1 −0 Gemfile
  2. +6 −0 site/steincollectors.rb
View
@@ -14,3 +14,4 @@ gem "nokogiri"
gem "escape_utils"
gem "escape" # for shell-command escaping
gem "mime-types"
+gem 'sinatra-xsendfile'
@@ -3,6 +3,7 @@
$:.unshift File.dirname(__FILE__) + '/../lib'
require 'rubygems'
require 'sinatra'
+require 'sinatra-xsendfile'
require 'sequel'
require 'ruport'
require 'erb'
@@ -31,6 +32,11 @@ class SteinCollectors
WEBMASTER_CONTACT_EMAIL = 'sci@steincollectors.org'
ONE_HOUR_IN_SECONDS = 3600
+ configure :production do
+ Sinatra::Xsendfile.replace_send_file! # replace Sinatra's send_file with x_send_file
+ set :xsf_header, 'X-Accel-Redirect' # set x_send_file header (default: X-SendFile)
+ end
+
before do
@errors = params[:errors]
@messages = params[:messages]

0 comments on commit 323a029

Please sign in to comment.