Next.js Discord

Discord Forum

Help Needed: Issue with Excessive API Calls Due to Canonical and Hreflang Links in Next.js 14

Unanswered
Hermes posted this in #help-forum
Open in Discord
Hi everyone,

I’m facing an issue with my Next.js 14 project related to canonical and hreflang links. When I access a page, Next.js is prefetching the same page for all locales, resulting in unnecessary fetch requests for each language.

For example, when I visit http://localhost:3000/en/cities/6, I see fetch requests for French, Arabic, Hindi, Chinese, and English versions of the page. Here’s a snippet of the logs:
Fetching cities for locale fr
Fetching cities for locale ar
Fetching cities for locale hi
Fetching cities for locale zh
Fetching cities for locale en

0 Replies