perf(imaging): add s-maxage so Cloudflare caches avatar images
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:
1 parent
14a3de0f2a
commit
fd8ab7db93
1 file changed
+4
-1
@@ -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": "*",
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user