Infinite redirect in middleware

export default defineNuxtRouteMiddleware(async (to, from) => { const url = window.location.href; // Check if we are on "localhost:3000" if (url.includes("localhost:3000")) { console.log(to.path, from.path); return navigateTo(to.fullPath); } return abortNavigation(); }); How can i solved this ?
No description
3 Replies
/home/devNaimul
/home/devNaimul4mo ago
@manniL / TheAlexLichter please help
manniL
manniL4mo ago
what are you trying? (also make sure that window is actually a thing, it isn't on server)
/home/devNaimul
/home/devNaimul4mo ago
how can i get full url in middleware ? export default defineNuxtRouteMiddleware(async (to, from) => { const url = useRequestURL(); if (!url.href.includes("localhost:3000") && !url.href.includes("ejily.com")) { // return abortNavigation(); return navigateTo("/"); } }); this is working now.
Want results from more Discord servers?
Add your server