Cacheable Http 204 (No Content) responses to GET request not cached
Categories
(Core :: Networking: Cache, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: frederic.delaporte, Assigned: kershaw)
Details
(Whiteboard: [necko-triaged])
Attachments
(1 file)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0
Steps to reproduce:
Have an api which, on a GET request, responds a 204 No Content with a Cache-Control: Public,max-age=1200 directive, no expires, no pragma, no vary.
Query it through a GET ajax call in a Html page.
Query it again identically before expiration (typically by browsing again the page).
Actual results:
Firefox queried the api twice.
Expected results:
Firefox should have not queried the api a second time.
Chrome does just that : query only once, reusing the previous result from cache the second time.
The problem can be reproduced in a new profile.
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Since nsHttpResponseHead::MustValidate returns true when the status is 204, we can't serve the response from the cache entry.
Not sure if we can simply add 204 in nsHttpResponseHead::MustValidate.
Honza, what do you think?
Comment 2•5 years ago
|
||
https://tools.ietf.org/html/rfc7231#section-6.3.5
A 204 response is cacheable by default; i.e., unless otherwise
indicated by the method definition or explicit cache controls (see
Section 4.2.2 of [RFC7234]).
we also write it on MDN: 204 No Content - HTTP | MDN
so, yes, we should add 204 to nsHttpResponseHead::MustValidate
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
Pushed by kjang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a73d370a3a6f Cache 204 response r=mayhemer
Comment 5•5 years ago
|
||
Backed out for wpt failures on heuristic.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/935c358f8c635132e0bb0d0be624294d9b720035
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=256743065&repo=autoland&lineNumber=30768
Assignee | ||
Comment 6•5 years ago
|
||
Oh, I was not aware of that we already have wpt test for 204 response.
I'll fix this.
Pushed by kjang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a8eb1b6edb40 Cache 204 response r=mayhemer
Comment 8•5 years ago
|
||
bugherder |
Description
•