cache-control (#423)

Change CACHE_MAX_AGE to CACHE_CONTROL in AWS and Cloudflare
This commit is contained in:
Markus Wendorf
2024-07-09 10:11:33 +02:00
committed by GitHub
parent c2a3fcc5e7
commit dd8fdcd37d
4 changed files with 8 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ interface Env {
// biome-ignore lint: config name
BUCKET: R2Bucket;
// biome-ignore lint: config name
CACHE_MAX_AGE?: number;
CACHE_CONTROL?: string;
// biome-ignore lint: config name
PMTILES_PATH?: string;
// biome-ignore lint: config name
@@ -134,8 +134,9 @@ export default {
) => {
cacheableHeaders.set(
"Cache-Control",
`max-age=${env.CACHE_MAX_AGE || 86400}`
env.CACHE_CONTROL || "public, max-age=86400"
);
const cacheable = new Response(body, {
headers: cacheableHeaders,
status: status,

View File

@@ -9,4 +9,4 @@ r2_buckets = [
[vars]
# ALLOWED_ORIGINS = "http://localhost:8000"
# CACHE_MAX_AGE = 86400
# CACHE_CONTROL = "public, max-age=86400"