Skip to content

Consecutive slashes in URL trigger routing error and no page renders in browser when Next.js runs behind gateway #70948

Description

@cosieLq

Link to the code that reproduces this issue

https://github.com/cosieLq/exampleApp_nextjs/tree/reproduction-double-slash-routing-error

To Reproduce

  1. Start the application (npm run dev or npm run start)
  2. Start the gateway (node proxy.js)
  3. Go to localhost:8000///about
  4. Observe browser console and see 'Error: invariant: invalid relative URL, router received...'

Current vs. Expected behavior

I expected no error in browser console and the page to render correctly.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Wed Jul 31 20:48:52 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 20.15.1
  npm: 10.7.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 15.0.0-canary.179 // Latest available version is detected (15.0.0-canary.179).
  eslint-config-next: N/A
  react: 19.0.0-beta-04b058868c-20240508
  react-dom: 19.0.0-beta-04b058868c-20240508
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Internationalization (i18n), Navigation, Pages Router

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local), Other (Deployed)

Additional context

When i18n is disabled in next.config.js, no error will appear and the page renders correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Internationalization (i18n)Related to Internationalization with Next.js.Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.Pages RouterRelated to Pages Router.bugIssue was opened via the bug report template.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions