Set X-Sendfile Header Only for Local Proxy Requests

If the request.remote_addr is not LOCALHOST, don't set the
X-Sendfile header.
This commit is contained in:
Jacques Distler 2009-03-05 12:14:03 -06:00
parent 9ff1e82211
commit 13d096c688
2 changed files with 15 additions and 1 deletions

View file

@ -85,7 +85,7 @@ class ApplicationController < ActionController::Base
original_options[:type] ||= (FILE_TYPES[File.extname(file_name)] or 'application/octet-stream')
original_options[:disposition] ||= (DISPOSITION[original_options[:type]] or 'attachment')
original_options[:stream] ||= false
original_options[:x_sendfile] = true if request.env.include?('HTTP_X_SENDFILE_TYPE')
original_options[:x_sendfile] = true if request.env.include?('HTTP_X_SENDFILE_TYPE') && request.remote_addr == LOCALHOST
original_options
end