don't enable x-sendfile by default for local file store
This prevents open source installs from seeing file downloads break in rails3. They can still set up sendfile explicitly by configuring their web server and uncommenting the appropriate line, I've added documentation to the production start wiki page: https://github.com/instructure/canvas-lms/wiki/Production-Start#optimizing-file-downloads relatedly, remove the unused send_file_or_data method. Change-Id: I5e856b2ba50b0606330f86360d175c439ee1da50 Reviewed-on: https://gerrit.instructure.com/40357 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> Product-Review: Brian Palmer <brianp@instructure.com> QA-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
parent
28d7c936c4
commit
d8d747f187
|
@ -1465,17 +1465,6 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
helper_method :page_views_enabled?
|
||||
|
||||
# calls send_file if the io has a local file, or send_data otherwise
|
||||
# make sure to rewind the io first, if necessary
|
||||
def send_file_or_data(io, opts = {})
|
||||
cancel_cache_buster
|
||||
if io.respond_to?(:path) && io.path.present? && File.file?(io.path)
|
||||
send_file(io.path, opts)
|
||||
else
|
||||
send_data(io, opts)
|
||||
end
|
||||
end
|
||||
|
||||
def verified_file_download_url(attachment, *opts)
|
||||
file_download_url(attachment, { :verifier => attachment.uuid }, *opts)
|
||||
end
|
||||
|
|
|
@ -19,9 +19,9 @@ environment_configuration(defined?(config) && config) do |config|
|
|||
# eval <env>-local.rb if it exists
|
||||
Dir[File.dirname(__FILE__) + "/" + File.basename(__FILE__, ".rb") + "-*.rb"].each { |localfile| eval(File.new(localfile).read) }
|
||||
|
||||
# Specifies the header that your server uses for sending files
|
||||
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
||||
|
||||
# Specifies the header that your web server uses for directly sending files
|
||||
# If you have mod_xsendfile enabled in apache:
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile'
|
||||
# For nginx:
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
||||
|
||||
|
|
Loading…
Reference in New Issue