Skip to content

Accept header negotiation beforeFiles#8276

Merged
rickhanlonii merged 1 commit intoreactjs:mainfrom
icyJoseph:fix/accept-header-rewrite
Jan 30, 2026
Merged

Accept header negotiation beforeFiles#8276
rickhanlonii merged 1 commit intoreactjs:mainfrom
icyJoseph:fix/accept-header-rewrite

Conversation

@icyJoseph
Copy link
Copy Markdown
Contributor

@icyJoseph icyJoseph commented Jan 29, 2026

On the deployed version, the rewrite has to be declared to happen beforeFiles.

You can try this the fix out here: https://react-dev-sepia.vercel.app/ - I'll tear the link/project down after this lands.

# 1. Normal page request (should return HTML)
curl -s https://react-dev-sepia.vercel.app/learn/thinking-in-react | head -5

# 2. With Accept: text/markdown (should return markdown)
curl -s -L -H "Accept: text/markdown" https://react-dev-sepia.vercel.app/learn/thinking-in-react | head -15

# 3. Explicit .md extension (should return markdown)
curl -s https://react-dev-sepia.vercel.app/learn/thinking-in-react.md | head -15

# 4. /llms.txt normal (should return sitemap)
curl -s https://react-dev-sepia.vercel.app/llms.txt | head -10

# 5. /llms.txt with Accept: text/markdown (should still return sitemap)
curl -s -L -H "Accept: text/markdown" https://react-dev-sepia.vercel.app/llms.txt | head -10

@github-actions
Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@icyJoseph icyJoseph mentioned this pull request Jan 29, 2026
@rickhanlonii
Copy link
Copy Markdown
Member

Sick thank you!

@rickhanlonii rickhanlonii merged commit 24ec67e into reactjs:main Jan 30, 2026
8 checks passed
@rickhanlonii
Copy link
Copy Markdown
Member

Works great, thanks @icyJoseph!

@gaearon
Copy link
Copy Markdown
Member

gaearon commented Mar 28, 2026

Screenshot 2026-03-27 at 21 09 25

for some reason Claude can't fetch it at all. could this be related?

@gaearon
Copy link
Copy Markdown
Member

gaearon commented Mar 28, 2026

here's what CC claims

Screenshot 2026-03-27 at 21 23 34

@icyJoseph
Copy link
Copy Markdown
Contributor Author

icyJoseph commented Mar 28, 2026

It could be yeah, the API route handler could be getting the api/md for .md + content-type header. So the path segment for the doc becomes ["api", "md", "reference"]

For some reason when Claude often strips .md from the url when passing it to the WebFetch tool, I had to explicitly prompt Claude to keep the extension.

I can have a PR in a minute, sorry about this.

@icyJoseph
Copy link
Copy Markdown
Contributor Author

#8379 @gaearon 🙏 - Claude should be able to use https://react-dev-plum.vercel.app/reference/react/useOptimistic.md as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants