DEV: apply cdn headers to public javascripts endpoint too. (#11942)

It will add CORS header `Access-Control-Allow-Origin: '*'` to the files inside `public/javascripts` folder.
This commit is contained in:
Vinoth Kannan 2021-02-03 20:15:52 +05:30 committed by GitHub
parent aa09373813
commit 024f2720f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -32,8 +32,9 @@ class Discourse::Cors
def self.apply_headers(cors_origins, env, headers)
request_method = env['REQUEST_METHOD']
cdn_endpoints = ["/assets", "/javascripts"]
if env['SCRIPT_NAME'] == "/assets" && Discourse.is_cdn_request?(env, request_method)
if cdn_endpoints.include?(env['SCRIPT_NAME']) && Discourse.is_cdn_request?(env, request_method)
Discourse.apply_cdn_headers(headers)
elsif cors_origins
origin = nil