From 6c2d3038f421a94171594c70d490daeec1e1a2d7 Mon Sep 17 00:00:00 2001
From: Jeong Arm <kjwonmail@gmail.com>
Date: Fri, 24 Jun 2022 06:09:32 +0900
Subject: [PATCH] Fix CDN_HOST not affected on full_asset_url (#18662)

* Fix CDN_HOST not affected to assets url

* Fix typo
---
 app/helpers/routing_helper.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/helpers/routing_helper.rb b/app/helpers/routing_helper.rb
index f95f46a560..0d5a8505a2 100644
--- a/app/helpers/routing_helper.rb
+++ b/app/helpers/routing_helper.rb
@@ -16,7 +16,11 @@ module RoutingHelper
   def full_asset_url(source, **options)
     source = ActionController::Base.helpers.asset_url(source, **options) unless use_storage?
 
-    URI.join(root_url, source).to_s
+    URI.join(asset_host, source).to_s
+  end
+
+  def asset_host
+    Rails.configuration.action_controller.asset_host || root_url
   end
 
   def full_pack_url(source, **options)
-- 
GitLab