Repository navigation
fix: let a wildcard If-None-Match take precedence in date-only conditional routes - #1881
Merged
He-Pin merged 1 commit intoNov 29, 2026
Merged
Conversation
…ional routes Follow-up to apache#1868. With only a modification date configured, a request with If-None-Match: * fell through to If-Modified-Since. The wildcard matches any current representation and If-None-Match takes precedence over If-Modified-Since (RFC 9110 sections 13.1.2 and 13.1.3), so GET and HEAD now get 304 and other methods get 412. Co-Authored-By: Claude Fable 5.2 <[email protected]>
He-Pin
approved these changes
Nov 29, 2026
He-Pin
approved these changes
Nov 29, 2026
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.
Follow-up to #1868, covering the gap I noted in my review there.
Problem
conditional(lastModified)(no ETag) with a request carryingIf-None-Match: *fell through to theIf-Modified-Sincestep. RFC 9110 §13.1.3 saysIf-Modified-Sincemust be ignored whenIf-None-Matchis present, and §13.1.2 says the wildcard condition is false whenever the server has a current representation.Change
In step 3 of
conditional, when the request hasIf-None-Match: *, no ETag is configured and a modification date is configured (so a current representation is known to exist):304 Not Modified, regardless ofIf-Modified-Since.412 Precondition Failed.This matches what the directive already does for the wildcard when an ETag is configured. When neither an ETag nor a modification date is given, behaviour is unchanged.
Behaviour change to be aware of
A
PUT/POST/DELETEwithIf-None-Match: *through a date-onlyconditionalpreviously reached the inner route and now gets 412. That is the point of the wildcard (create only if absent), but it is visible to applications.Tests
Added cases to
CacheConditionDirectivesSpecfor GET and HEAD (304 even whenIf-Modified-Sincealone would select the representation), PUT (412), and the unchanged no-validator case. Ran that spec and the scalafmt checks for the two touched modules locally; the rest is left to CI.🤖 Generated with Claude Code