From b526a2ac86bdfb36f5fb33c47ba1383dd4903dbc Mon Sep 17 00:00:00 2001 From: Danilo Campana Fuchs <danilo_fuchs@hotmail.com> Date: Wed, 4 Oct 2023 20:57:19 +0200 Subject: [PATCH] fix: Correct cache control for static js/css files (#34171) --- src/metabase/server/request/util.clj | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/metabase/server/request/util.clj b/src/metabase/server/request/util.clj index 6162c271879..7d9329238e3 100644 --- a/src/metabase/server/request/util.clj +++ b/src/metabase/server/request/util.clj @@ -34,14 +34,13 @@ (defn cacheable? "Can the ring request be permanently cached?" - [{:keys [request-method uri query-string], :as _request}] + [{:keys [request-method uri], :as _request}] (and (= request-method :get) (or - ;; match requests that are js/css and have a cache-busting query string - (and query-string - (re-matches #"^/app/dist/.*\.(js|css)$" uri)) + ;; match requests that are js/css and have a cache-busting hex string + (re-matches #"^/app/dist/.+\.[a-f0-9]{20}\.(js|css)$" uri) ;; any resource that is named as a cache-busting hex string (e.g. fonts, images) - (re-matches #"^/app/dist/[a-f0-9]{20}+.*$" uri)))) + (re-matches #"^/app/dist/[a-f0-9]{20}.*$" uri)))) (defn https? "True if the original request made by the frontend client (i.e., browser) was made over HTTPS. -- GitLab