From 6b379f33d244f8996d70b1c91a9c97bff3b55f8a Mon Sep 17 00:00:00 2001 From: Parsa Yazdani Date: Mon, 31 Mar 2025 17:18:28 +1100 Subject: [PATCH] Update cloudflare worker.js --- cloudflare worker.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cloudflare worker.js b/cloudflare worker.js index 619dd26..ce6bfa6 100644 --- a/cloudflare worker.js +++ b/cloudflare worker.js @@ -979,14 +979,15 @@ function handleOptions() { } // Helper to create standardized responses -function createResponse(body, status = 200, shouldCache = false, cacheDuration = 300) { +function createResponse(body, status = 200, cacheDuration = 60*60*24) { const headers = { 'Content-Type': 'application/json', ...corsHeaders }; - if (shouldCache) { + if (cacheDuration > 0) { headers['Cache-Control'] = `public, max-age=${cacheDuration}`; + headers['CDN-Cache-Control'] = `public, max-age=${cacheDuration}`; } else { headers['Cache-Control'] = 'no-store'; }