Skip to content

feat(agentic): add vary header to markdown negotiation - #1431

Merged
larbish merged 1 commit into
mainfrom
fix/markdown-vary-header
Aug 26, 2026
Merged

feat(agentic): add vary header to markdown negotiation#1431
larbish merged 1 commit into
mainfrom
fix/markdown-vary-header

Conversation

@larbish

@larbish larbish commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Reported by an Is Agentic scan of docus.dev, which saw Vary: none.

Summary

Advertise Vary: Accept, User-Agent on pages that answer in both HTML and markdown. Without it a shared cache can serve the HTML variant to an agent asking for markdown, or the reverse, since both live at the same URL.

Changes

layer/modules/vercel-markdown-rewrite.ts (renamed from markdown-rewrite.ts)

The rewrite headers carry vary, plus one trailing continue: true route applying it to the HTML variant of every negotiated path. It runs after the rewrites, which terminate for markdown clients, so only non-markdown requests reach it.

Paths are regex-escaped when building that route: a slug like /en/concepts/node-20.x would otherwise leak a wildcard into the Vercel matcher.

The new name makes the scope explicit, since the module is a no-op on any non-Vercel preset: matching on a request header has no equivalent in the static config of other providers, so the header is emitted here rather than through provider-agnostic route rules.

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docus Ready Ready Preview Aug 26, 2026 10:56am

@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/create-docus@1431
npm i https://pkg.pr.new/docus@1431

commit: 841649f

@larbish
larbish merged commit 545b05f into main Aug 26, 2026
5 checks passed
@larbish
larbish deleted the fix/markdown-vary-header branch August 26, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant