Skip to content
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

Stop appending preload links once the head is already 1kB #48405

Merged
merged 1 commit into from Jun 7, 2023

Conversation

casperisfine
Copy link
Contributor

Fix: #48402

Some HTTP client and proxies have a 4kiB header limit, but more importantly including preload links has diminishing returns so it's best to not go overboard

1kB worth of preload links should be plenty.

cc @nateberkopec

@rails-bot rails-bot bot added the actionview label Jun 6, 2023
@nateberkopec
Copy link
Contributor

The test provides a nice idea of how many links this will append - about a dozen.

My only question - this appends the first dozen links. What if those aren't the most useful ones to be appending? We always want "application.js" and "application.css" to be appended, but what if there are 15 other files before that?

@casperisfine
Copy link
Contributor Author

If you need tighter control you can do it with custom logic in the controller or a middleware.

Fix: rails#48402

Some HTTP client and proxies have a 4kiB header limit, but more importantly
including preload links has diminishing returns so it's best to not go overboard

1kB worth of preload links should be plenty.
@byroot byroot merged commit 0c09ae5 into rails:main Jun 7, 2023
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link headers generated by Rails may exceed nginx's upstream limit
4 participants