cloudflare/vinext

i18n routing: `locale: false` on rewrites/redirects not implemented

Closed

#1,336 opened on May 20, 2026

 (1 comment) (0 reactions) (0 assignees)TypeScript (371 forks)github user discovery
adapter-api-e2ehelp wanted

Repository metrics

Stars
 (8,563 stars)
PR merge metrics
 (Avg merge 1d 1h) (462 merged PRs in 30d)

Description

This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-20).

Problem

Several i18n routing features are not properly implemented:

  1. locale: false on rewrite/redirect sources not implemented. When a rewrite or redirect in next.config.js specifies locale: false on the source, the pattern should match the raw path without locale prefix handling. vinext does not honor this flag, so rewrites/redirects fail to match when they should.

  2. Locale detection re-runs on every request instead of being sticky. After the initial locale is established, client-side navigations should preserve it. vinext appears to re-detect from Accept-Language on each server request, causing the locale to flip unexpectedly.

  3. Locale prefix not stripped for API routes. Requests like /fr/api/ok need the locale prefix stripped before API route matching. vinext does not strip it, causing 404s.

  4. Default locale prefix stripping missing. Requests to /en/page (where en is the default locale) should redirect to /page. This redirect is not happening.

Expected: "en"
Received: "id"  // locale flipped to browser preference on client nav

Estimated Impact

~24 test failures across the deploy suite.

Affected Test Suites

  • test/e2e/i18n-ignore-rewrite-source-locale/rewrites.test.ts (8 failures, all 8 tests)
  • test/e2e/i18n-ignore-redirect-source-locale/redirects-with-basepath.test.ts (4 failures)
  • test/e2e/i18n-ignore-redirect-source-locale/redirects.test.ts (4 failures)
  • test/e2e/ignore-invalid-popstateevent/with-i18n.test.ts (3 failures)
  • test/e2e/ignore-invalid-popstateevent/without-i18n.test.ts (2 failures)
  • test/e2e/i18n-preferred-locale-detection/i18n-preferred-locale-detection.test.ts (1 failure)
  • test/e2e/i18n-default-locale-redirect/i18n-default-locale-redirect.test.ts (1 failure)
  • test/e2e/middleware-custom-matchers-i18n/test/index.test.ts (1 failure)

Recommendation

  1. Reproduce first in vinext's own test suite. Add tests for: (a) a rewrite with locale: false source matching a non-locale-prefixed path, (b) locale persistence across client navigations, (c) API routes under locale prefixes. Confirm they fail.

  2. Study Next.js i18n implementation. Search .nextjs-ref/packages/next/src/server/ for locale: false, locale detection, and locale stripping logic.

  3. Implement locale: false flag. When evaluating rewrite/redirect sources with locale: false, skip the locale prefix injection and match against the raw path.

  4. Make locale detection sticky. Once a locale is established (either by URL prefix or initial detection), it should be preserved across navigations. The locale context should be carried in the client-side router state.

  5. Strip locale prefix for API routes. Add locale stripping before the API route matching step.

Contributor guide