mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
feat(frontend): ⚡ Add Cache-Control header to frontends served
This commit is contained in:
parent
9834825184
commit
5dd6ea4d10
|
|
@ -94,6 +94,7 @@ const handleManifestRequest = async () => {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json; charset=utf-8",
|
"Content-Type": "application/json; charset=utf-8",
|
||||||
"Content-Length": String(JSON.stringify(manifest).length),
|
"Content-Length": String(JSON.stringify(manifest).length),
|
||||||
|
"Cache-Control": "max-age=31536000",
|
||||||
Date: new Date().toUTCString(),
|
Date: new Date().toUTCString(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -171,6 +172,7 @@ const returnFile = async (file: BunFile, content?: string) => {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": `${file.type}; charset=utf-8`,
|
"Content-Type": `${file.type}; charset=utf-8`,
|
||||||
"Content-Length": String(file.size),
|
"Content-Length": String(file.size),
|
||||||
|
"Cache-Control": "max-age=31536000",
|
||||||
Date: new Date().toUTCString(),
|
Date: new Date().toUTCString(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,8 @@ export const createServer = (
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
proxy?.headers.set("Cache-Control", "max-age=31536000");
|
||||||
|
|
||||||
if (!proxy || proxy.status === 404) {
|
if (!proxy || proxy.status === 404) {
|
||||||
if (config.frontend.glitch.enabled) {
|
if (config.frontend.glitch.enabled) {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue