feat: let the content app return 304 Not Modified for unchanged files - #7995
Open
carlosthe19916 wants to merge 1 commit into
Open
feat: let the content app return 304 Not Modified for unchanged files#7995carlosthe19916 wants to merge 1 commit into
carlosthe19916 wants to merge 1 commit into
Conversation
carlosthe19916
force-pushed
the
add-if-modified-since-content-app
branch
3 times, most recently
from
August 20, 2026 14:05
2246d02 to
95c8958
Compare
carlosthe19916
force-pushed
the
add-if-modified-since-content-app
branch
3 times, most recently
from
August 21, 2026 08:44
2e9b68b to
a193f54
Compare
run, without downloading the file again. Last-Modified is RepositoryContent.pulp_created for the served version, not disk mtime. Filesystem and ArtifactResponse get Cache-Control: public, max-age=0, must-revalidate; object-storage 302s do not. Redis can 304 from a cached last_modified without rebuilding the body. Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
carlosthe19916
force-pushed
the
add-if-modified-since-content-app
branch
from
August 21, 2026 09:20
a193f54 to
46bc167
Compare
carlosthe19916
marked this pull request as ready for review
August 21, 2026 09:22
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.
Summary
If-Modified-Sincewith 304 Not Modified and no body, so an edge cache can keep its copy instead of downloading the file again.Last-Modifiedis when that unit joined the served repository version (RepositoryContent.pulp_created). Disk mtime moves on copy/restore, and the version’s created time would make every cached file look stale on each publish.ArtifactResponse). Object-storage 302s get neitherLast-ModifiednorCache-Control: public, because a signed URL must not be stored or reused as if it were the file.Fixes #7929.
Guards still run first. A matching
If-Modified-Sinceis 304; otherwise the response is 200 withLast-Modifiedand the body. If there is no membership row (publish-generated metadata, remote-only distribution), Pulp omitsLast-Modifiedand never returns 304.Artifact 200s and 304s include
Cache-Control: public, max-age=0, must-revalidateso the edge revalidates on every use. Plugins can still override headers withcontent_headers_for. This change does not addETag._serve_cais the single place that looks up the timestamp and may 304 (published files, pass-through, repository versions, plugincontent_handler(), grace-period fallback, pull-through). Grace-period fallback uses the old publication’s version so the timestamp is not the current one. On-demand streams 304 before opening the remote. A stream that has already started writing is never turned into a 304.aiohttp’s
FileResponsewould overwriteLast-Modifiedwith disk mtime.PulpFileResponsestops that, does not send a disk-timeETag, and does not clearIf-Range.When Redis is on, the handler returns a cacheable 200 and the cache layer owns the 304: it stores
last_modified, 304s a hit without rebuilding the response, and never writes a 304 into Redis.Not in this PR: 304 on S3/Azure/GCS redirects,
ETag/If-None-Match, or a fallback timestamp for metadata with no membership row.Test plan
PulpFileResponsedoes not 304 on file mtime and does not clearIf-Rangelast_modified, 304s a hit without rebuilding, and never caches a 304