mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 02:51:14 +08:00
This reverts commit e3de45359f9bc7a71d9b8045a7e369fd0cf8f433. We need to improve out strategy by adding a cache breaker with this change ... some assets on CDNs and clients may have incorrect CORS headers which can cause stuff to break.
This commit is contained in:
@ -17,7 +17,6 @@ end
|
||||
|
||||
module Discourse
|
||||
DB_POST_MIGRATE_PATH ||= "db/post_migrate"
|
||||
REQUESTED_HOSTNAME ||= "REQUESTED_HOSTNAME"
|
||||
|
||||
require 'sidekiq/exception_handler'
|
||||
class SidekiqExceptionHandler
|
||||
@ -910,24 +909,6 @@ module Discourse
|
||||
def self.is_parallel_test?
|
||||
ENV['RAILS_ENV'] == "test" && ENV['TEST_ENV_NUMBER']
|
||||
end
|
||||
|
||||
CDN_REQUEST_METHODS ||= ["GET", "HEAD", "OPTIONS"]
|
||||
|
||||
def self.is_cdn_request?(env, request_method)
|
||||
return unless CDN_REQUEST_METHODS.include?(request_method)
|
||||
|
||||
cdn_hostnames = GlobalSetting.cdn_hostnames
|
||||
return if cdn_hostnames.blank?
|
||||
|
||||
requested_hostname = env[REQUESTED_HOSTNAME] || env[Rack::HTTP_HOST]
|
||||
cdn_hostnames.include?(requested_hostname)
|
||||
end
|
||||
|
||||
def self.apply_cdn_headers(headers)
|
||||
headers['Access-Control-Allow-Origin'] = '*'
|
||||
headers['Access-Control-Allow-Methods'] = CDN_REQUEST_METHODS.join(", ")
|
||||
headers
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:enable Style/GlobalVars
|
||||
|
Reference in New Issue
Block a user