Closed Willem-Jaap closed 3 months ago
Is your favicon located inside the [locale]
folder? Otherwise if it's not ignored but should be as specified in your middleware configuration, I believe it's a Next.js bug.
Well, thats the fun part, I don't actually have a favicon. Seems like Chrome automatically fetches /favicon.icon even if it is not in the <head>
.
https://bugs.chromium.org/p/chromium/issues/detail?id=39402#c47
But, in this case I think `next-international should ignore [locale] props not matched by middleware, like my '/assets'
Maybe the matcher can be passed to the I18nMiddleware like this and then don't log errors for routes not matched by this expression.
Any update on this? I keep getting this: [next-international] The locale 'favicon.ico' is not supported. Defined locales are: [en, ar]. Even though the middleware should be ignoring the favicon file as a route. This causes my content to disappear sometimes and only the layout shows.
I am using rewrite as the mapping strategy, when navigating to a page should I append the current locale to the start of the href?
This is usually caused by:
1) the middleware being miss-configured
2) the favicon.ico
file being placed inside the [locale]
folder, which should instead be inside the app
(or src
) folder
Could you share more context on your app?
I am using rewrite as the mapping strategy, when navigating to a page should I append the current locale to the start of the href?
This is done automatically by the middleware if you don't do it manually.
I have the middleware exactly as it is in the docs. My favicon is not in the locale folder. I think the problem is mainly for the home page "/" since everything else works fine.
I have an api that gets called on the main page route and for some reason it does not get called. I have an api directory for next auth in my app directory but not inside the [locale] route. Could this be causing issues?
EDIT: Issue was next.js config related. works perfectly now. Thanks!
My setup is as described in the documentation
The layout contains the following code:
However, this locale prop also receives
favicon.ico
in the locale property.Next-international also logs the following error
[next-international] The locale 'favicon.ico' is not supported. Defined locales are: [en, nl].
The favicon is not matched in the middleware, just like in the docs (https://next-international.vercel.app/docs/app-setup#setup-middleware)
To Reproduce I don't think this is repository specific, but you can clone https://github.com/pixel-perfect-agency/next-foundation
Expected behavior Favicon and other routes ignored in middleware matcher should not be perceived as locales
About: