This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow-site.git
The following commit(s) were added to refs/heads/main by this push:
new 210807cad1 Stop the docs version dropdown from lagging behind a docs
publish (#1678)
210807cad1 is described below
commit 210807cad1e9de80a11d63410982051ddee9129a
Author: Shahar Epstein <[email protected]>
AuthorDate: Wed Oct 7 20:29:07 2026 +0300
Stop the docs version dropdown from lagging behind a docs publish (#1678)
The version selector fills its dropdown from /_gen/packages-metadata.json,
which is served without Cache-Control. Browsers therefore keep it under
heuristic freshness (10% of its age) and the CDN caches it for an unknown
time, so right after a release a freshly published page shows "Version:
1.0.0" while the dropdown still lists the previous version as stable. In
Chrome a plain reload does not refetch it; only a hard reload does.
Sending max-age=60 bounds both caches and fixes already-published docs
without a theme release; the no-cache fetch option makes new theme builds
revalidate on every page view regardless of server headers.
---
landing-pages/site/static/.htaccess | 9 +++++++++
landing-pages/src/js/versionSelector.js | 4 +++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/landing-pages/site/static/.htaccess
b/landing-pages/site/static/.htaccess
index 1f5414eb3d..d081b86815 100644
--- a/landing-pages/site/static/.htaccess
+++ b/landing-pages/site/static/.htaccess
@@ -1,5 +1,14 @@
RewriteEngine On
+# The docs version selector fetches this file on every page view. Without a
Cache-Control
+# header, browsers and the CDN keep a copy for hours after a release and the
dropdown lags
+# behind the page it is shown on.
+<IfModule mod_headers.c>
+ <Files "packages-metadata.json">
+ Header set Cache-Control "max-age=60"
+ </Files>
+</IfModule>
+
# Redirect bare /registry to /registry/ for consistent trailing-slash URLs
RewriteRule ^registry$ /registry/ [R=301,L]
diff --git a/landing-pages/src/js/versionSelector.js
b/landing-pages/src/js/versionSelector.js
index d59d328527..6ff2ad3a66 100644
--- a/landing-pages/src/js/versionSelector.js
+++ b/landing-pages/src/js/versionSelector.js
@@ -135,7 +135,9 @@ const runVersionSelector = () => {
return;
}
- fetch("/_gen/packages-metadata.json")
+ // Revalidate on every page view so the dropdown never lags a docs publish;
the server
+ // ETag makes this a cheap 304 round trip.
+ fetch("/_gen/packages-metadata.json", {cache: "no-cache"})
.then((resp) => resp.json())
.then((packageInfos) => {
const {currentPackageName} = getCurrentPageInfo();