Skip to content

[12.x] Allow limiting number of assets to preload #55618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 12.x
Choose a base branch
from

Conversation

timacdonald
Copy link
Member

@timacdonald timacdonald commented May 1, 2025

When preloading a lot of assets, this header can become problematically long. It can cause issues by overflowing the web servers maximum header length or simply be so long that it would be better off not sending it and allowing the html preload tags to kick in.

That isn't to say preloading via this header isn't a good default; it is. This is only for those applications that have an extreme number of assets that are to be preloaded by Vite.

This PR ensures you can limit the number of assets to preload to give some control over the header length.

- AddLinkHeadersForPreloadedAssets::class,
+ AddLinkHeadersForPreloadedAssets::using(limit: 10),

If we merge this PR I will roll out a sensible default to our packages.

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