Repository navigation
Send preload Link headers from vite_tags - #63
Open
olivier-thatch wants to merge 2 commits into
Open
olivier-thatch wants to merge 2 commits into
olivier-thatch wants to merge 2 commits into
Conversation
olivier-thatch
marked this pull request as ready for review
November 14, 2026 00:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
vite_tagsnow adds the assets it emits to the response'sLinkheader and sends them as 103 Early Hints, like Rails'javascript_include_tagandstylesheet_link_tag. It followsconfig.action_view.preload_links_header(on withload_defaults6.1+), and takes a per-callpreload_links_header:that overrides it, with the same name and precedence as Rails 7.1+.Link: </vite/assets/application-x9y8z7w6.css>; rel=preload; as=style; nopush,</vite/assets/application-a1b2c3d4.js>; rel=modulepreload; as=script; nopush,</vite/assets/vendor-b3c4d5e6.js>; rel=modulepreload; as=script; nopushsend_preload_links_header, which writes the header the running Rails version expects: 7.0 joins early hints with newlines underLink, 7.1+ with commas underlink. It also stops at 1 KB and skips streamed responses.crossorigin,integrity, andnonceof its tag. With SRI, a stylesheet preload withoutcrossorigin=anonymouswould make the browser fetch it twice.Apps on
load_defaults6.1+ get the header on upgrade.