-
Notifications
You must be signed in to change notification settings - Fork 578
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
The cache handler should not invalidate all requests to an origin #3806
Labels
bug
Something isn't working
Comments
cc @flakey5 |
I agree, I also realized that like 2-3 weeks ago. I think I tried to solve this in my PR, which i did not touch since you commented on it. |
flakey5
added a commit
to flakey5/undici
that referenced
this issue
Nov 8, 2024
Closes nodejs#3806 Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
flakey5
added a commit
to flakey5/undici
that referenced
this issue
Nov 8, 2024
Closes nodejs#3806 Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
flakey5
added a commit
to flakey5/undici
that referenced
this issue
Nov 8, 2024
Closes nodejs#3806 Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
flakey5
added a commit
to flakey5/undici
that referenced
this issue
Nov 8, 2024
Closes nodejs#3806 Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When the cache-handler recevies a succesful response from one of "unsafe" http methods such as POST/PUT/DELETE... it invalidates all other cached responses to this origin.
https://github.com/nodejs/undici/blob/main/lib/handler/cache-handler.js#L79
RFC says:
A cache MUST invalidate the target URI ([Section 7.1](https://www.rfc-editor.org/rfc/rfc9110#section-7.1) of [[HTTP](https://www.rfc-editor.org/rfc/rfc9111.html#HTTP)]) when it receives a non-error status code in response to an unsafe request method (including methods whose safety is unknown).
By "target URI" here I understand the the full URL and not just an origin (correct me here if I;m wrong). For example if a client receives a succesful response for the
DELETE http://example.com/foo/bar
the cache hanlder can delete theGET http://example.com/foo/bar
, but not all other cached responses to thehttp://example.com
.IMHO With a current behaviour the cache seems useless, because a one regulary called POST requests keeps your cache almost always empty.
The text was updated successfully, but these errors were encountered: