From 7a5a6c6177b0fb5e35648fb88f366d0aab3b0deb Mon Sep 17 00:00:00 2001 From: Juan Sebastian Montoya Date: Wed, 26 Nov 2025 16:52:51 -0500 Subject: [PATCH] chore: rrevent caching of version.json and add cache-busting to fetch request --- nginx.conf | 7 +++++++ src/game/Game.js | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/nginx.conf b/nginx.conf index 2c3229d..08a7ce9 100644 --- a/nginx.conf +++ b/nginx.conf @@ -9,6 +9,13 @@ server { try_files $uri $uri/ =404; } + # Prevent caching of version.json + location = /version.json { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + add_header Pragma "no-cache"; + add_header Expires "0"; + } + # Enable gzip compression gzip on; gzip_types text/html text/css application/javascript; diff --git a/src/game/Game.js b/src/game/Game.js index 76aef4c..0c96122 100644 --- a/src/game/Game.js +++ b/src/game/Game.js @@ -509,7 +509,11 @@ export class Game { } loadVersion() { - fetch('/version.json') + // Add cache-busting query parameter to ensure fresh version data + const cacheBuster = `?t=${Date.now()}`; + fetch(`/version.json${cacheBuster}`, { + cache: 'no-store' + }) .then(response => { if (response.ok) { return response.json();