Rewrites for static NextJS page + localized routing + app folder

Hello,

I have followed this guide for internationalization: The Ultimate Guide to internationalization (i18n) in Next.js 13 - DEV Community

I have 2 locales, “de” and “en”. They are mandatory by default as the page is static. If there is no locale in the URL, I want to display english content.

This was working on vercel / netlify & static export, and now I am trying to do the same on render.

This was my vercel.json file:

{
  "rewrites": [
    {
      "source": "/api/:match*",
      "destination": "https://abcdefg.onrender.com/:match*"
    },
    {
      "source": "/",
      "destination": "/en"
    },
    {
      "source": "/:path((?!en|de/).*)",
      "destination": "/en/:path*"
    }
  ]
}

I have added those rules in the render dashboard (I had to remove the “*” on “/en/:path*” as apparently this is not allowed):

mypage.com/api → works, proxies to API
mypage.com/de → works, displays german content
mypage.com/en → works, displays english content
mypage.com/en/login → works, displays english content

mypage.com → does not work, should display english content, but just displays a white page (returns a 200 without any response body). I think this should be already matched by the first rule.
same issue for mypage.com/login, gives 200 / blank page:

Any idea what I am doing wrong?

Hi,

It looks like my colleague has picked up the ticket you also raised. To avoid any confusion, let’s keep the conversation in one place (on the ticket). Then you can update this post when you reach the solution.

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.