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
ETags don't take assets into account #42544
Comments
I guess a digest of the manifest could be used as a seed.
I don't think this one is worth it. You basically need to render the view to know what assets are linked, so you'd lose a huge part of the perf gain. You'd still save sending the body, but you would have rendered it. |
Doh, of course. 🤦♂️ |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
still relevant |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
still relevant |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
still relevant |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
still relevant |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
still relevant |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
still relevant |
Consider the below controller action, layout, and view:
Note the use of
fresh_when
inPostsController#show
to set an ETag response header based on@post
./posts/1
, assuming a Post exists with ID 1.application
stylesheet./posts/1
and back.Your browser will perform a conditional GET using the ETag from the response to the request in step 1. It’ll receive a 304 Not Modified response from the app, even though the
application
stylesheet’s fingerprint has changed.The browser will then request the old stylesheet. Worst case: the old stylesheet doesn’t exist anymore, and the page may be rendered unstyled. Best case: it does still exist, but it contains the old styles.
To fix, we could incorporate asset fingerprints into ETags by default. Low-touch: incorporate all asset fingerprints into ETags for all cached HTML requests. More sophisticated: only assets explicitly linked from the view.
The text was updated successfully, but these errors were encountered: