Skip to content

Partial requests without X-RSC-Router-Client-Path match a cross-origin Referer's pathname as the navigation source #1005

Closed

Description

@ivogt

Low priority. The router's own client always sends X-RSC-Router-Client-Path, so this only affects partial requests made without it.

Problem

When a partial request carries no X-RSC-Router-Client-Path, the navigation source falls back to the Referer header:

  • getNavigationContextHeader, src/router/navigation-snapshot.ts:42-46;
  • resolveNavigation builds prevUrl = new URL(previousUrl, url.origin) (:97), then matches prevUrl.pathname against this router's table (:111).

An absolute cross-origin Referer keeps its foreign origin, but only its pathname is matched. For example, https://other.example/product/42 is matched as /product/42 on this app. The source route, its params and its name then come from a page the visitor was never on. That source drives:

  • the segment diff (which segments are treated as already on the client);
  • intercept selection;
  • intercept when's from, which gains from.params in the client-when PR.

Expected

Ignore a Referer whose origin differs from the request's. Treat it as no navigation context, the same as a missing header. Alternatively, drop the Referer fallback entirely if no supported client relies on it.

Notes

Not reproduced end to end. The behavior follows from the code above. Found during review of the client-when PR.

Activity

  1. added a commit that references this issue on Oct 3, 2026
    548d41a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions