With Next.JS 14, I am aiming to display a page for clients who request access via a browser. If the request comes from an alternate source, I would like to redirect them to another website. While I have successfully implemented the redirect function in the code provided below, I am struggling to find documentation on how to actually display the page. I would greatly appreciate any assistance or guidance you can offer on this matter. Thank you.
// handling GET requests
export async function GET(request) {
const headersList = headers();
if(!headersList.get("Accept").includes("text/html")) {
return NextResponse.redirect("https://example.com");
}
return Page(); //DISPLAYING THE LAYOUT
}