mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: remove hardcoding from middleware stack so we can control it
This commit is contained in:
parent
5032c96486
commit
6019e3f257
4 changed files with 1 additions and 22 deletions
|
@ -76,7 +76,7 @@ class StaticController < ApplicationController
|
|||
|
||||
# we must disable acceleration otherwise NGINX strips
|
||||
# access control headers
|
||||
request.env['_disable_accl'] = true
|
||||
request.env['sendfile.type'] = ''
|
||||
send_file(path, opts)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -122,13 +122,6 @@ module Discourse
|
|||
# supports etags (post 1.7)
|
||||
config.middleware.delete Rack::ETag
|
||||
|
||||
# We need to be able to disable for cdn assets
|
||||
# x-accl-redirect strips headers we need to forward
|
||||
# issue open since 2008
|
||||
require 'middleware/optional_sendfile'
|
||||
config.middleware.insert_after Rack::Sendfile, Middleware::OptionalSendfile, config.action_dispatch.x_sendfile_header
|
||||
config.middleware.delete Rack::Sendfile
|
||||
|
||||
# route all exceptions via our router
|
||||
config.exceptions_app = self.routes
|
||||
|
||||
|
|
|
@ -21,9 +21,6 @@ Discourse::Application.configure do
|
|||
# Generate digests for assets URLs
|
||||
config.assets.digest = true
|
||||
|
||||
# Specifies the header that your server uses for sending files
|
||||
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation can not be found)
|
||||
config.i18n.fallbacks = true
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
module Middleware
|
||||
class OptionalSendfile < Rack::Sendfile
|
||||
def call(env)
|
||||
if env["_disable_accl"] == true
|
||||
@app.call(env)
|
||||
else
|
||||
super(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue