Skip to content

framework: fix vary header - #1209

Merged
undefined-moe merged 1 commit into
hydro-dev:masterfrom
renbaoshuo:fix-vary-header
Sep 15, 2026
Merged

undefined-moe merged 1 commit into
hydro-dev:masterfrom
renbaoshuo:fix-vary-header

Conversation

@renbaoshuo

@renbaoshuo renbaoshuo commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved response caching behavior by including content negotiation in the Vary response header.
    • Preserved existing Vary header values when handling CORS responses, improving compatibility with caches and clients that rely on multiple request headers.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 0cc3c3c4-a629-42dd-af62-8d0fa2a1721b

📥 Commits

Reviewing files that changed from the base of the PR and between 6635257 and e8e69b9.

📒 Files selected for processing (2)
  • framework/framework/base.ts
  • framework/framework/server.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


Walkthrough

The base Koa middleware now adds Accept to the Vary response header when a request has a handler. CORS handling now uses Koa's vary() method for Origin and Referer, which merges these values with existing Vary values instead of overwriting them.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: undefined-moe

Merge Risk: ⚪ Minimal · up to e8e69

The Vary-header changes should merge existing response variation values without introducing a known runtime or compatibility risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing Vary header handling in the framework.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

framework/framework/base.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

framework/framework/server.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

if (c.request.headers.origin) {
c.set('Access-Control-Allow-Origin', c.request.headers.origin);
c.set('Vary', 'Origin');
c.vary('Origin');
@undefined-moe
undefined-moe merged commit 238b126 into hydro-dev:master Sep 15, 2026
5 of 6 checks passed
@renbaoshuo
renbaoshuo deleted the fix-vary-header branch September 16, 2026 04:46
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.

3 participants