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

[5.x] Set etag and lastModified if available #11441

Open
wants to merge 1 commit into
base: 5.x
Choose a base branch
from

Conversation

indykoning
Copy link
Contributor

This change will add the etag header to every page response, allowing browsers and more to determine wether their file is still fresh.

And in case of an updated_at being available set the last modified header.

see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified

This would allow crawlers to adjust their crawl frequency on pages not often updated.
And allow browsers to determine wether their page is fresh.

However if the browser supports an etag that will be used instead.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#heuristic_caching:~:text=Note%3A%20RFC9110%20prefers%20that%20servers%20send%20both%20ETag%20and%20Last%2DModified

This PR differs a lot compared to #11430
as this is not meant to let CDN's or other parties in-between cache pages as it still sends private, must-revalidate
https://github.com/symfony/symfony/blob/6f4f04b98f6134996a57d21d1851d558a34dc45c/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php#L246

Instead this is meant to support revalidation instead of never being allowed to serve from browser cache.

They will function together without any problems though.

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