feat(writeEarlyHints): add Link: rel:preload headers as fallback#1288
feat(writeEarlyHints): add Link: rel:preload headers as fallback#1288
Link: rel:preload headers as fallback#1288Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds support for array-valued hints in writeEarlyHints, prefers native res.writeEarlyHints when available, and adds a CDN-friendly fallback that emits Link headers when native early hints are absent. Documentation and tests were updated to reflect the behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/utils/response.ts`:
- Around line 69-85: The fallback currently appends all hint headers from hints
into event.res.headers using event.res.headers.append, which can leak
undesirable headers (e.g., Set-Cookie); restrict the fallback to only propagate
Link headers: check for the "link" header key (case-insensitive) in hints and
append only those values (handling both string and string[] cases) via
event.res.headers.append, skipping any other hint names; keep the native early
hints branch (event.runtime?.node?.res?.writeEarlyHints) unchanged.
resolves #1279
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests