Maintenance Page
This content is from /Maintenance page. Middleware intercepted the request and rewrote the request to maintenance page since isInMaintenanceMode flag is true.
The middleware middleware.js file has the following code.
Check the response header X-Middleware-Rewrite: and you will see the middleware interception.
import { NextRequest, NextResponse } from "next/server";
import { get } from "@vercel/edge-config";
export const config = {
matcher: "/payment",
};
export async function middleware(req: NextRequest) {
// Check Edge Config to see if the maintenance page should be shown
const isInMaintenanceMode = await get("isInMaintenanceMode");
// If in maintenance mode, point the url pathname to the maintenance page
if (isInMaintenanceMode) {
req.nextUrl.pathname = '/maintenance';
// Rewrite to the url
return NextResponse.rewrite(req.nextUrl);
}
}