Skip to content

Commit

Permalink
delete smart placement, update caching policy
Browse files Browse the repository at this point in the history
now cache-control is visible, content will be cached 30s in local and 12h at edge
  • Loading branch information
ihsangan committed Aug 6, 2024
1 parent 72a995a commit a3ff799
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ export default async function checkCache(request: Request): Promise<Response> {
await cache.put(request.url, response.clone());
}
response = new Response(response.body, response);
response.head
response.headers.delete('Cache-Control');
response.headers.append('X-Response-Time', timeNow() - now);
return response;
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export default async function serveResult(request: Request): Promise<Response> {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, HEAD',
'Access-Control-Expose-Headers': 'X-Response-Time, X-Powered-By',
'Cache-Control': 'max-age=43200, proxy-revalidate, immutable',
'Access-Control-Expose-Headers': 'Age, X-Powered-By, X-Response-Time',
'Age': 0,
'CF-Cache-Status': 'MISS',
'Cache-Control': 'public, max-age=30, s-maxage=43200, proxy-revalidate, immutable',
'Content-Type': 'application/json; charset=utf-8',
'X-Powered-By': '@ihsangan/valid'
}
Expand Down
4 changes: 1 addition & 3 deletions wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
name = "validator"
main = "./src/index.ts"
workers_dev = true
compatibility_date = "2022-01-01"
[placement]
mode = "smart"
compatibility_date = "2022-01-01"

0 comments on commit a3ff799

Please sign in to comment.