Skip to content

Rewrite loop when using next-dev with localhost and different ports e.g. MultiZone setup #56615

@PacoSoftwerft

Description

@PacoSoftwerft

Link to the code that reproduces this issue

https://github.com/PacoSoftwerft/multi-zone-microfrontends

To Reproduce

Start main-site

cd main-site
npm run dev

Start blog

Start the blog in a new shell

cd blog
npm run dev

Bug

Open http://localhost:3000/blog, it is loading in a loop.

Current vs. Expected behavior

Expected behavior:

rewrite to same domain "localhost" with different port should work like they did in 13.4.12

Version [email protected] is working just fine.
Stop the main-site then

cd main-site
npm i [email protected] --save-exact
npm run dev

open http://localhost:3000/blog

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

Node:           v18.18.0
npm:            10.1.0

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

Routing (next/router, next/navigation, next/link)

Additional context

This bug was introduced with 13.4.13

The bug only appears when using the Pages Router

The bug depends on the version of the app that rewrites, here main-site.

It seems like the port is stripped/not respected somewhere.

The rewrite works if it points to another domain.

Additional info 2023-10-20

The bug only appears when both zones are started with npm run dev

main (3000) blog (3001) works?
npm run dev npm run dev
npm run dev npm run build npm run start
npm run build npm run start npm run dev
npm run build npm run start npm run build npm run start

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions