Skip to content

Commit

Permalink
Disable 404 caching
Browse files Browse the repository at this point in the history
  • Loading branch information
zefhemel committed Nov 17, 2023
1 parent d4d7221 commit a984ab1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions server/http_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
},
Expand Down
7 changes: 3 additions & 4 deletions web/service_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ async function handleLocalFileRequest(
request: Request,
pathname: string,
): Promise<Response> {
// 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<FileContent>([...filesContentPrefix, path]);
if (data) {
Expand Down Expand Up @@ -164,6 +160,9 @@ async function handleLocalFileRequest(
);
return new Response("Not found", {
status: 404,
headers: {
"Cache-Control": "no-cache",
},
});
}
}
Expand Down
3 changes: 0 additions & 3 deletions website/SilverBullet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a984ab1

Please sign in to comment.