Request for Assistance with Routing Issue in Starter Kit
Unanswered
Armin posted this in #help-forum
ArminOP
Hello Community,
First and foremost, I'd like to express my sincere gratitude to everyone involved in creating this fantastic starter kit. It's been a valuable resource for me. However, I've encountered a challenge that I'm hoping to get some assistance with.
I'm currently experiencing an issue where only the root path (localhost:3000) is loading correctly. Any other path results in a 404 error. I suspect the issue may lie within a specific snippet in middleware.ts, which is responsible for routing:
When I alter this snippet to the following:
I'm able to reach the login page, but unfortunately, I can't navigate beyond it. This issue has been a bit of a roadblock for me for the past week. Despite my research efforts and a post on https://github.com/vercel/platforms/discussions/368, I haven't been able to resolve it.
Additionally, when accessing http://localhost:3000/api/auth/providers, I receive the following response:
Any insights, suggestions, or guidance on how to resolve this would be immensely appreciated. I'm eager to learn and understand where I might be going wrong and how to fix it.
Thank you so much for your time and help!
First and foremost, I'd like to express my sincere gratitude to everyone involved in creating this fantastic starter kit. It's been a valuable resource for me. However, I've encountered a challenge that I'm hoping to get some assistance with.
I'm currently experiencing an issue where only the root path (localhost:3000) is loading correctly. Any other path results in a 404 error. I suspect the issue may lie within a specific snippet in middleware.ts, which is responsible for routing:
// rewrite root application to `/home` folder
if (
hostname === "localhost:3000" ||
hostname === process.env.NEXT_PUBLIC_ROOT_DOMAIN
) {
return NextResponse.rewrite(
new URL(`/home${path === "/" ? "" : path}`, req.url),
);
}When I alter this snippet to the following:
return NextResponse.rewrite(
new URL(`/app${path === "/" ? "" : path}`, req.url),
);I'm able to reach the login page, but unfortunately, I can't navigate beyond it. This issue has been a bit of a roadblock for me for the past week. Despite my research efforts and a post on https://github.com/vercel/platforms/discussions/368, I haven't been able to resolve it.
Additionally, when accessing http://localhost:3000/api/auth/providers, I receive the following response:
{
"github": {
"id": "github",
"name": "GitHub",
"type": "oauth",
"signinUrl": "http://localhost:3000/api/auth/signin/github",
"callbackUrl": "http://localhost:3000/api/auth/callback/github"
}
}Any insights, suggestions, or guidance on how to resolve this would be immensely appreciated. I'm eager to learn and understand where I might be going wrong and how to fix it.
Thank you so much for your time and help!