Skip to content

Commit

Permalink
perf: reduce Vercel serveless function usage (#106)
Browse files Browse the repository at this point in the history
Increase s-maxage for CDN caching and max-age for client-side caching, also add stale-while-revalidate that allow us to serve content from the Edge cache.
  • Loading branch information
vn7n24fzkq committed Sep 21, 2022
1 parent fe6a293 commit b67d461
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"github": {
"silent": true
},
"rewrites": [{ "source": "/api/(.*)", "destination": "/api" }],
"rewrites": [{"source": "/api/(.*)", "destination": "/api"}],
"headers": [
{
"source": "/api/cards/(.*)",
"headers": [
{
"key": "cache-control",
"value": "public, max-age=0, s-maxage=14400"
"value": "public, max-age=21600, s-maxage=21600, stale-while-revalidate=14400"
}
]
},
{
"source": "/api/theme",
"headers": [
{ "key": "Access-Control-Allow-Credentials", "value": "true" },
{ "key": "Access-Control-Allow-Origin", "value": "*" },
{"key": "Access-Control-Allow-Credentials", "value": "true"},
{"key": "Access-Control-Allow-Origin", "value": "*"},
{
"key": "Access-Control-Allow-Methods",
"value": "GET,OPTIONS,PATCH,DELETE,POST,PUT"
Expand All @@ -34,6 +34,6 @@
"source": "/",
"destination": "/demo"
},
{ "source": "/demo", "destination": "/demo.html" }
{"source": "/demo", "destination": "/demo.html"}
]
}

0 comments on commit b67d461

Please sign in to comment.