add cache-control

This commit is contained in:
zizifn
2022-12-13 23:57:23 +08:00
committed by zizifn
parent 9394da5651
commit 1d9a130a72

View File

@@ -8,9 +8,11 @@ async function serveClient(req: Request, basePath: string) {
}
const pathname = new URL(req.url).pathname;
if (pathname.startsWith('/assets')) {
return await serveDir(req, {
const resp = await serveDir(req, {
fsRoot: `${Deno.cwd()}/apps/deno-vless/src/client`,
});
resp.headers.set('cache-control', 'public, max-age=2592000');
return resp;
}
if (pathname.includes(basePath)) {
return await serveFile(