Skip to content

Instantly share code, notes, and snippets.

@sitefinitySDK
Created February 7, 2025 14:05
Show Gist options
  • Save sitefinitySDK/282856e50d4a6856daadd34a6ec0916b to your computer and use it in GitHub Desktop.
Save sitefinitySDK/282856e50d4a6856daadd34a6ec0916b to your computer and use it in GitHub Desktop.
if (!hasAuthCookie && !request.nextUrl.pathname.startsWith('/render-lazy')) {
const headers = request.headers;
headers.set('x-cached-route-processed', 'true');
let url = new URL(request.url);
url.pathname = '/cached' + request.nextUrl.pathname;
return NextResponse.rewrite(url, {
request: {
headers: headers
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment