From a984ab1f82e02fc20f8ff79721586a39a756ece2 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Fri, 17 Nov 2023 13:54:48 +0100 Subject: [PATCH] Disable 404 caching --- server/http_server.ts | 1 + web/service_worker.ts | 7 +++---- website/SilverBullet.md | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/server/http_server.ts b/server/http_server.ts index 08219b96..adccfbb7 100644 --- a/server/http_server.ts +++ b/server/http_server.ts @@ -438,6 +438,7 @@ export class HttpServer { } catch (e: any) { console.error("Error GETting file", name, e.message); response.status = 404; + response.headers.set("Cache-Control", "no-cache"); response.body = "Not found"; } }, diff --git a/web/service_worker.ts b/web/service_worker.ts index 0a9f0a8f..da538340 100644 --- a/web/service_worker.ts +++ b/web/service_worker.ts @@ -123,10 +123,6 @@ async function handleLocalFileRequest( request: Request, pathname: string, ): Promise { - // if (!db?.isOpen()) { - // console.log("Detected that the DB was closed, reopening"); - // await db!.open(); - // } const path = decodeURIComponent(pathname.slice(1)); const data = await ds?.get([...filesContentPrefix, path]); if (data) { @@ -164,6 +160,9 @@ async function handleLocalFileRequest( ); return new Response("Not found", { status: 404, + headers: { + "Cache-Control": "no-cache", + }, }); } } diff --git a/website/SilverBullet.md b/website/SilverBullet.md index 0c5140f7..a909d0cc 100644 --- a/website/SilverBullet.md +++ b/website/SilverBullet.md @@ -6,9 +6,6 @@ SilverBullet is implemented as an open-source, self-hosted, offline-capable web You’ve been told there is _no such thing_ as a [silver bullet](https://en.wikipedia.org/wiki/Silver_bullet). You were told wrong. -> **note** Note -> While SilverBullet has been under development for close to two years, we are still making significant changes from time to time (for the better, hopefully) that may _occasionally_ break some things. Be prepared to upgrade regularly, and while data loss has been extremely rare, keep your [[Space]] backed up! And watch [[CHANGELOG]] to see what’s cooking! - ## Quick links * [[Install]]: how to install and deploy SilverBullet * [[Manual]]: the beginnings of a user manual