mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 22:26:38 +03:00
Add edge cache headers to all API routes to reduce Vercel function invocations
All API routes serve static content that only changes at deploy time, but had 0% cache hit rate. Adding s-maxage=86400 lets Vercel's CDN cache responses at the edge, which should take the ~28K daily API requests from 0% to ~99% cache. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a9c66c4cda
commit
98d16686dc
@@ -23,6 +23,7 @@ export default function handler(req, res) {
|
||||
}
|
||||
|
||||
const content = readFileSync(commandPath, "utf-8");
|
||||
res.setHeader("Cache-Control", "public, s-maxage=86400, stale-while-revalidate=3600");
|
||||
res.status(200).json({ content });
|
||||
} catch (error) {
|
||||
console.error("Error in /api/command-source:", error);
|
||||
|
||||
Reference in New Issue
Block a user