Added cache control
This commit is contained in:
parent
3a3e008e90
commit
d62722ce53
10
loled.js
10
loled.js
@ -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"))
|
||||||
|
Loading…
Reference in New Issue
Block a user