Changeset e2ea5c4 in Klonkt
- Timestamp:
- 07/21/2026 03:55:26 AM (7 weeks ago)
- Branches:
- main
- Children:
- fb30b5d
- Parents:
- f574435
- git-author:
- Robin <roboburr@…> (07/21/2026 03:55:23 AM)
- git-committer:
- Robin <roboburr@…> (07/21/2026 03:55:26 AM)
- Location:
- src
- Files:
-
- 2 edited
-
middleware/render.js (modified) (1 diff)
-
server.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/middleware/render.js
rf574435 re2ea5c4 73 73 // (Vary also applies to intermediate caches / Cloudflare.) 74 74 res.setHeader('Vary', 'HX-Request'); 75 if (isPartial) res.setHeader('Cache-Control', 'no-store'); 75 // A full HTML page must always be revalidated so an online visitor gets the 76 // fresh site, never a heuristically-cached copy. no-cache (not no-store) still 77 // allows bfcache and conditional requests. Partials stay no-store (see above). 78 res.setHeader('Cache-Control', isPartial ? 'no-store' : 'no-cache'); 76 79 77 80 // Does this (non-god) user own a site? Determines whether they see an "Admin" -
src/server.js
rf574435 re2ea5c4 478 478 res.set('Cache-Control', 'no-cache'); 479 479 res.send(` 480 const CACHE_VERSION = 'pcms-v1 7-' + new Date().toISOString().split('T')[0];480 const CACHE_VERSION = 'pcms-v18-' + new Date().toISOString().split('T')[0]; 481 481 self.addEventListener('install', e => { 482 482 e.waitUntil(caches.open(CACHE_VERSION).then(c => c.addAll(['/']))); … … 503 503 try { if (new URL(e.request.url).origin !== self.location.origin) return; } catch (err) { return; } 504 504 e.respondWith( 505 fetch(e.request).then(resp => { 505 // { cache: 'no-store' }: go to the network for the page, bypassing the browser's 506 // HTTP cache, so an online visitor ALWAYS gets the fresh site and never a 507 // heuristically-cached copy served through the SW. The cache is only a 508 // last-resort offline fallback (the .catch below). 509 fetch(e.request, { cache: 'no-store' }).then(resp => { 506 510 // Network-first: always serve fresh when online. Also refresh the '/' offline 507 511 // fallback with the homepage we just served, so a later cold start on a flaky or
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)