Skip to content

Weird alternate links #1676

Closed Answered by alexbuznik-stark
alexbuznik-stark asked this question in Q&A
Discussion options

You must be logged in to vote

I think I figured it out right after posting.

Since I was not including all the locales in the routing config to avoid polluting the thing with 3k options (and this was causing ERR_RESPONSE_HEADERS_TOO_BIG), the router was not considering some custom locales like fi-US a locale, but rather a pathname.

The solution:

  • include all the locales options (~3k) in the routing.ts.
  • remove unnecessary ones from the response headers:

handleI18nRouting.ts:

import LinkHeader from 'http-link-header'
import { NextRequest } from 'next/server'
import { routing } from '../i18n/routing'
import createMiddleware from 'next-intl/middleware'
import { STANDARD_LOCALES } from '../i18n/settings'

const handleI18nR…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by alexbuznik-stark
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants