Next.js Discord

Discord Forum

_next/image not found (404) due to locale prefix

Unanswered
Britannia Petite posted this in #help-forum
Open in Discord
Britannia PetiteOP
We ran into an issue that our locale caused all _next/images to throw 404:

 GET /de/_next/image?url=MY_URL 404 in 33ms
 GET /de/_next/image?url=MY/URL 404 in 37ms


The issue was the de prefix (our locale). It could also be en or es or what ever locale.

Once we added this to our nextjs,config it worked again:

  async rewrites() {
    return [
      {
        source: "/de/_next/:path*",
        destination: "/_next/:path*",
      },
]


But I was wondering: It seems very clumsy and expensive to do this for all our images. Is there not a more elegant solution to exclude images from locale totally?

Thanks for any pointers!

0 Replies