Skip to content

[Workers] Document cf.vary request option#31754

Open
zaidoon1 wants to merge 2 commits into
productionfrom
zaidoon/workers-cf-vary-docs
Open

[Workers] Document cf.vary request option#31754
zaidoon1 wants to merge 2 commits into
productionfrom
zaidoon/workers-cf-vary-docs

Conversation

@zaidoon1

Copy link
Copy Markdown
Collaborator

Add Workers Request cf.vary reference docs, a fetch cache example, and a Cache Vary cross-link.

Documentation checklist

  • Is there a changelog entry (guidelines)? If you don't add one for something awesome and new (however small) — how will our customers find out? Changelogs are automatically posted to RSS feeds, the Discord, and X.
  • The change adheres to the documentation style guide.
  • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.
  • Files which have changed name or location have been allocated redirects.

Add Workers Request cf.vary reference docs, a fetch cache example, and a Cache Vary cross-link.
@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review

💡 1 suggestion found in commit a352957.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

No code review issues found.

Conventions

Checks PR title, description, and redirect checklist.

No convention issues found.

Style Guide Review

Suggestions (1)
File Issue
workers/examples/cache-using-fetch.mdx line 29 Unused component imports — Imports TabItem and Tabs but neither component tag appears in the patch Fix: Remove TabItem and Tabs from the import if they are not used elsewhere, or use them in the added content

Redirects

No missing redirect entries found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.

@github-actions github-actions Bot added product:workers Related to Workers product product:cache Issues or PRs related to Cache size/m labels Jun 28, 2026
@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/changelog/ @cloudflare/pm-changelogs, @cloudflare/product-owners
/src/content/docs/cache/ @cloudflare/product-owners, @ack-cf, @zaidoon1
/src/content/docs/workers/ @cloudflare/workers-docs, @GregBrimble, @irvinebroque, @mikenomitch, @korinne, @WalshyDev, @cloudflare/deploy-config, @cloudflare/product-owners, @cloudflare/wrangler, @MattieTK, @cloudflare/dev-plat-leads, @vy-ton

@ask-bonk

ask-bonk Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review for PR #31754

Summary

This PR adds documentation for the new cf.vary request init option in Workers. It makes three well-targeted changes:

  1. src/content/docs/workers/runtime-apis/request.mdx — Adds vary to the RequestInitCfProperties list and introduces a new #### The cf.vary property subsection with full schema details, limits, validation rules, and a JSON example.
  2. src/content/docs/workers/examples/cache-using-fetch.mdx — Adds a TypeScriptExample showing how to use cf.vary in a fetch() call.
  3. src/content/docs/cache/concepts/vary.mdx — Cross-links from the Cache Vary concept page to the new Workers reference.

Labels to apply

documentation, workers, cache

Issues to address

Severity Issue Location
🔴 Misleading statement about supported keys request.mdx line ~186
🔴 Imprecise shorthand for object property request.mdx line ~188
🟡 Consider adding a changelog entry src/content/changelog/

Inline suggestions

src/content/docs/workers/runtime-apis/request.mdx — line ~186

"The default object and custom header entries support only action."

This contradicts the table directly above it, which shows accept and accept-language entries also support media_types and languages. Consider clarifying:

The `default` object and most custom header entries support only `action`. The `accept` and `accept-language` entries also support the additional keys listed above.

src/content/docs/workers/runtime-apis/request.mdx — line ~188

"For most deployments, set default to bypass..."

default is an object (e.g. { action: "bypass" }), not a string. Consider:

For most deployments, set `default.action` to `bypass`, add entries for expected origin `Vary` headers, and use `normalize` for `accept` and `accept-language` unless your origin requires raw header values.

Notes

  • Cross-links are correct — all internal links use root-relative paths with trailing slashes (/workers/runtime-apis/request/#the-cfvary-property, /cache/concepts/vary/, etc.).
  • Component imports are correctTypeScriptExample is properly imported in cache-using-fetch.mdx; Type and MetaInfo are already available in request.mdx.
  • No MDX syntax issues — no unescaped {, }, <, or > characters in prose.
  • Prettier — both request.mdx and cache-using-fetch.mdx fail prettier --check, but this is a pre-existing issue on the production branch and not introduced by this PR.

Question for the author

Since cf.vary is new functionality being documented, should a changelog entry be added in src/content/changelog/workers/ (or cache/) so customers discover it via RSS and Discord? This is item #1 in the PR checklist.

github run

Clarify the cf.vary object shape and add a Workers changelog entry for the request option.
@zaidoon1 zaidoon1 requested a review from a team as a code owner June 28, 2026 09:03

@irvinebroque irvinebroque left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Labels

product:cache Issues or PRs related to Cache product:workers Related to Workers product size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants