Skip to content

Commit

Permalink
adding cache control
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarpavlovsky committed Dec 7, 2023
1 parent 6bf4975 commit 58ac9e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/marginfi-v2-ui/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ 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('Cache-Control', 'public, max-age=14400');

if (process.env.AUTHENTICATION_DISABLED === "true") {
return NextResponse.next();
return response;
}

if (basicAuth) {
Expand All @@ -20,7 +22,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";
Expand Down

0 comments on commit 58ac9e7

Please sign in to comment.