Skip to content

Docs: next-url #57762

@cyber-nic

Description

@cyber-nic

What is the improvement or update you wish to see?

NextJS docs would be greatly improved with a detailed list of NextJS specific headers such as 'next-url'. Also, a recommended approach to obtaining the url pathname in server components would be a great addition as the headers() function does not always contain the desired information.

Is there any context that might help us understand?

The headers documentation would greatly benefit from the list of nextjs specific headers such as "next-url". Searching for 'next-url' in the docs produces no results, yet there are numerous examples online of its use to fetch the pathname in server components.

Furthermore, 'next-url' is unreliable as mentioned here in stackoverflow. The 'next-url' header is not present when navigating directly to a NextJS page (app router) but will eventually show up with HMR (in my experience). The solution suggested in Stackoverflow works perfectly, but this does seem like a band-aid for a possibly misunderstood logic.

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/api-reference/functions/headers

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationRelated to Next.js' official documentation.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions