Skip to content

[BUG] Page redirect applies the target route twice and mangles the URL #875

@SDrinkwater

Description

@SDrinkwater

Describe the bug

Calling redirect on page load results in the target route being added twice to the URL.

Example:

  • I have two pages
    • Home which lives at / and simply returns redirect("/target");
    • Target which lives at /target and returns <div>Target</div>;

Expected behaviour (and the behaviour I see when running via npm run dev):

Loading the / route takes me to /target

Observed behaviour:

Loading the / route takes me to /target,/target

Steps to reproduce

  • Create two pages
    • Home which lives at / and simply returns redirect("/target");
    • Target which lives at /target and returns <div>Target</div>;

Now load the / route and notice that it takes you to /target,/target.

Expected behavior

Redirecting on page load takes me to the target page.

Keeping with our example, this means:

Loading the / route takes me to /target

@opennextjs/cloudflare version

1.7.1

Wrangler version

4.34.0

next info output

Using vars defined in .dev.vars
/bin/sh: yarn: command not found

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14
Binaries:
  Node: 22.13.1
  npm: 11.1.0
  Yarn: N/A
  pnpm: 9.15.1
Relevant Packages:
  next: 15.4.6 // There is a newer version (15.5.2) available, upgrade recommended! 
  eslint-config-next: 15.4.6
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.2
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.5.2) available, upgrade recommended! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions