Repository navigation
Fix Last-Modified header on archive pages - #2042
Merged
Merged
Conversation
mattstauffer
requested review from
derickr,
saundefined,
sgolemon and
sy-records
as code owners
October 23, 2026 21:46
Last-Modified header on archive pages
|
LGTM, assume this would fix the local cache issues indeed |
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.
TL:DR: The 2026 archive page is sending a
Last-Modifiedheader based on when2026.php(the template file) was last modified, not based on when there is actually new articles. This PR fixes that.We ran into a local cache issue on the archive pages:
https://www.php.net/archive/2026.php sends a
Last-Modifiedheader based on themtimeof the2026.phpscript file. But new articles are data (news entries), not edits to that file, so publishing one never the file'smtimeand therefore doesn't advanceLast-Modified, which means it's currently been set to August 10 since the last modification of that file.A returning browser then revalidates with
If-Modified-Sinceset to that frozen date, always matches, and gets304 Not Modified. That means the browser keeps showing the stale archive forever. Only a hard refresh (which omitsIf-Modified-Since) reveals new articles.This is all about how the origin emits
Last-modifiedand how the browsers process it, and has nothing to do with the CDN.So, the fix:
Set
Last-Modifiedto the newer of the most recent article's publish time or the page's filemtime. This way, both new articles and template edits bust the local cache. I extracted this into anews_archive_last_modified()helper inlayout.incand applied it to2026.php.