i18nexus / next-i18n-router

Next.js App Router internationalized routing and locale detection.
MIT License
262 stars 18 forks source link

localeDetector spamming warning #73

Closed Kirill-Ponomarenko closed 6 months ago

Kirill-Ponomarenko commented 6 months ago

I'm getting thousands of warnings in the logs:

Reverting to using defaultLocale: en
No valid locales in accept-language header: *

To my understanding it comes from here: https://github.com/i18nexus/next-i18n-router/blob/main/src/localeDetector.ts#L18C5-L18C78

But from user's perspective everything works fine. And I actually don't have so much visits. Is there a way to disable this warnings?

i18nexus commented 6 months ago

That's interesting that you would be getting thousands of these warnings. This only occurs when a a visitor does not have a valid language header on their request. According to your warning, it appears that thousands of visitors accessing your website have an accept-language header of *. Most of the time this type of language header means a bot is accessing your website. You may be getting inundated by bot requests.

Regardless, it probably is not useful to have this warning since there is nothing you can do as a developer to affect the headers of incoming requests. We'll implement a patch to remove the warning.

Kirill-Ponomarenko commented 6 months ago

Most likely some infrastructure calls, because our site blocked from the internet.

Thanks, will wait for this update!

azimari-toure-ikbal commented 6 months ago

I just came here for the exact same reason. Thanks for pointing that out

Kirill-Ponomarenko commented 6 months ago

I think it may be next/link prefetch. We have a lot of links on one page and it can generate 16 requests at a time

i18nexus commented 6 months ago

Console warning removed in v5.4.3 👍

Kirill-Ponomarenko commented 6 months ago

Appreciate how quickly you took care of it, thanks