From 497dc6eaa714dbbd0c79fd45f7d69de01fad6e87 Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Tue, 12 May 2020 16:34:12 +0100 Subject: [PATCH] Add a global setting for CDN origin This is so that, on a multisite cluster, when we handle a CDN request, the hostname that is requested corresponds to one of the sites - specifically the default site. --- app/models/global_setting.rb | 1 + config/discourse_defaults.conf | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/models/global_setting.rb b/app/models/global_setting.rb index 57d22d6618c..f4425919ed3 100644 --- a/app/models/global_setting.rb +++ b/app/models/global_setting.rb @@ -140,6 +140,7 @@ class GlobalSetting hostnames << backup_hostname if backup_hostname.present? hostnames << URI.parse(cdn_url).host if cdn_url.present? + hostnames << cdn_origin_hostname if cdn_origin_hostname.present? hash["host_names"] = hostnames hash["database"] = db_name diff --git a/config/discourse_defaults.conf b/config/discourse_defaults.conf index 4adfdca7e94..ac71f6a8b6f 100644 --- a/config/discourse_defaults.conf +++ b/config/discourse_defaults.conf @@ -96,6 +96,9 @@ load_mini_profiler = true # recommended, cdn used to access assets cdn_url = +# The hostname used by the CDN to request assets +cdn_origin_hostname = + # comma delimited list of emails that have developer level access developer_emails =