Added cache control

This commit is contained in:
EpicKiwi 2023-09-21 11:15:06 +02:00
parent 3a3e008e90
commit d62722ce53
Signed by: epickiwi
GPG Key ID: C4B28FD2729941CE

View File

@ -82,12 +82,20 @@ app.use((ctx, next) => {
ctx.response.headers.append("Access-Control-Allow-Headers", "*") ctx.response.headers.append("Access-Control-Allow-Headers", "*")
if(ctx.request.method == "OPTION"){ if(ctx.request.method == "OPTION"){
ctx.response.status = 200 ctx.response.status = 204
} else { } else {
return next() return next()
} }
}) })
app.use((ctx, next) => {
if(ctx.request.url.pathname.startsWith("/_loled")){
ctx.response.headers.append("Cache-Control", "no-store")
}
return next()
})
// Static // Static
app.use(async (ctx, next) => { app.use(async (ctx, next) => {
if(ctx.request.url.pathname.startsWith("/_loled")) if(ctx.request.url.pathname.startsWith("/_loled"))