Skip to content

Next.js: Record what the proxy did on its span #27068

Backlog

Description

@chargome

A proxy span tells us that the proxy ran and how long it took. It does not tell us what the proxy decided.

What is missing

  • No response status code.
  • No marker for the outcome: continue, rewrite, redirect, or a direct response.
  • No rewrite or redirect target.

Every run is named middleware {METHOD}, and the request path is only in http.target. Users cannot tell a redirecting run from a pass-through run.

To do

  • Decide which attributes to set and check them against the span attribute conventions.
  • Find a way to read the outcome that also works under Turbopack, where the proxy is not wrapped at build time. Next.js marks the outcome on the response with x-middleware-next, x-middleware-rewrite and the Location header.
  • A rewrite target could also help with route parameterization, see Investigate NextResponse.rewrite for route parameterization #17843.

Activity

  1. linear-code commented on Dec 2, 2026

    @linear-code
  2. self-assigned this
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions