Say that a client has made a cross-origin request to read an object, which passed, and the client cached the results. Now, the client makes a new request to read the object, and the previous result is still cached in the browser.
The client makes this request:
GET /pony.png HTTP/1.1
Host: server.com
Origin: field.com
If-None-Match: "etag-abcd"
Now, say that "etag-abcd" is valid for the object. The server replies
HTTP/1.1 304 Not Modified
Etag: "etag-abcd"
Date: Tue, ...
Expires: Wed, ...
If this is a valid cross-origin request, is the server obliged to provide appropriate Access-Control-Allow-Origin and other headers? Or, is the client obliged to respect the CORS headers that would have come along with the original, cached result?
The Fetch standard is quite complex, but it contains phrases like "As the CORS check is not to be applied to responses whose status is 304 or 407...." that make me suspect fresh CORS headers would not be necessary in a 304 response.
On the other hand, my reading of §4.6, step 10.4, suggests that the headers in the 304 response take precedence and even replace any cached result in the headers of the original GET response.