Next.js Discord

Discord Forum

Root page is shown on i18n when it should not

Herc posted this in #help-forum
Open in Discord
I'm getting a weird behavior with the root path http://localhost:3000 using playwright for the e2e tests.

I have an "empty" root layout / and then a layout inside /[lng]/layout

I also have a middleware that takes care of the i18n routing.

The problem is that when I do:
await page.goto("/")

in playwright it gets stuck in http://localhost:3000 and it doesn't reroute.

I've worked around it by creating a route page that redirects, but it feels like a smell to have that redirect:
export default function RootPage() {

It only happens in playwright, when I test it manually the middleware redirects correctly.

0 Replies