Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
** Middleware Function to rewrite shops url based on user information stored in Sitecore Personalize
* @param req
* @returns NextResponse with a rewrite set
*/
export function middleware(req: NextRequest){
// Check if request is seasonal content and handle request to personalize experience
if(req.nextUrl.pathname.startsWith("/seasonal"))
{
return handleSeasonalRequest(req)
}
// Check if request is store content and handle request to personalize experience
if(req.nextUrl.pathname.startsWith("/store"))
{
return handleStoreRequest(req)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment