From ea68190d798994a8682d869f8e3f997913879d89 Mon Sep 17 00:00:00 2001 From: edgar Date: Thu, 7 Dec 2023 18:19:10 -0500 Subject: [PATCH] Updating cache control (#410) * adding cache control * update --- apps/marginfi-v2-ui/src/middleware.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/marginfi-v2-ui/src/middleware.ts b/apps/marginfi-v2-ui/src/middleware.ts index 31a4915b17..1c41ef3b25 100644 --- a/apps/marginfi-v2-ui/src/middleware.ts +++ b/apps/marginfi-v2-ui/src/middleware.ts @@ -7,9 +7,13 @@ export const config = { export function middleware(req: NextRequest) { const basicAuth = req.headers.get("authorization"); const url = req.nextUrl; + const response = NextResponse.next(); + response.headers.set('Vercel-CDN-Cache-Control', 'private, max-age=10'); + response.headers.set('CDN-Cache-Control', 'private, max-age=10'); + response.headers.set('Cache-Control', 'private, max-age=10'); if (process.env.AUTHENTICATION_DISABLED === "true") { - return NextResponse.next(); + return response; } if (basicAuth) { @@ -20,7 +24,7 @@ export function middleware(req: NextRequest) { const expectedPassword = process.env.AUTHENTICATION_PASSWORD || "admin"; if (providedUser === expectedUser && providedPassword === expectedPassword) { - return NextResponse.next(); + return response; } } url.pathname = "/api/auth";