Skip to content

Commit 9828f89

Browse files
authored
chore: cloudflare caching of SSG routes (#1100)
1 parent de85a37 commit 9828f89

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

apps/website/adapters/static/vite.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export default extendConfig(baseConfig, () => {
1313
plugins: [
1414
staticAdapter({
1515
origin: 'https://qwikui.com',
16+
include: ['/*'],
17+
exclude: ['/api/*'],
1618
}),
1719
],
1820
};

apps/website/public/_headers

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# https://developers.cloudflare.com/pages/platform/headers/
22

3+
# Static assets - long-term caching
34
/build/*
45
Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable
56

7+
# Documentation pages - shorter caching for content updates
68
/docs/*
7-
Cache-Control: public, max-age=3600, s-maxage=3600
9+
Cache-Control: public, max-age=3600, s-maxage=3600
10+
11+
# Root and other static pages - medium-term caching
12+
/*
13+
Cache-Control: public, max-age=7200, s-maxage=7200
14+
15+
# Override for API routes or dynamic content (if any)
16+
/api/*
17+
Cache-Control: no-cache

apps/website/public/_routes.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"include": ["/api/*"],
4+
"exclude": [
5+
"/_headers",
6+
"/_redirects",
7+
"/build/*",
8+
"/favicon.ico",
9+
"/manifest.json",
10+
"/service-worker.js",
11+
"/*"
12+
]
13+
}

0 commit comments

Comments
 (0)