mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FEATURE: allow users to pick a CDN for s3 assets
This commit is contained in:
@ -1,24 +0,0 @@
|
||||
module Middleware
|
||||
|
||||
class ApplyCDN
|
||||
|
||||
def initialize(app, settings={})
|
||||
@app = app
|
||||
end
|
||||
|
||||
def call(env)
|
||||
status, headers, response = @app.call(env)
|
||||
|
||||
if Discourse.asset_host.present? &&
|
||||
Discourse.store.external? &&
|
||||
(headers["Content-Type"].start_with?("text/") ||
|
||||
headers["Content-Type"].start_with?("application/json"))
|
||||
response.body = response.body.gsub(Discourse.store.absolute_base_url, Discourse.asset_host)
|
||||
end
|
||||
|
||||
[status, headers, response]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user