perf(imaging): add s-maxage so Cloudflare caches avatar images
CI / check (push) Successful in 38s
CI / release (push) Skipped
CI / deploy (push) Successful in 1m22s

Avatars are proxied from the slow Habbo upstream on every request
(~350ms each) and Cloudflare was serving them as DYNAMIC because the
Cache-Control had no s-maxage. Add s-maxage=86400 + stale-while-revalidate
so edge/CDN caches avatars and repeats are served instantly.
This commit is contained in:
openhands committed 2026-08-01 18:00:43 +02:00
1 parent 14a3de0f2a
commit fd8ab7db93
1 file changed
+4 -1
+4 -1
View File
@@ -90,7 +90,10 @@ export async function GET(request: NextRequest) {
status: 200,
headers: {
"Content-Type": contentType,
"Cache-Control": "public, max-age=3600",
// s-maxage lets Cloudflare/edge cache avatars (currently DYNAMIC),
// stale-while-revalidate keeps them fresh without blocking requests.
"Cache-Control":
"public, max-age=3600, s-maxage=86400, stale-while-revalidate=86400",
"Access-Control-Allow-Origin": "*",
},
});