What does the following HTTP 1.1 header mean?
If-None-Match: *
I understand it when using a strong or weak ETag or even a list of ETags, but I don't understant it's use when using star (*).
Edit: Would be nice to have some pseudocode (PHP code good also) that would show how/what to answer to "If-None-Match: *".
The answer is: it depends.
Suppose we have received
If-None-Match: *
If-Modified-Since: <yesterday date>
And the page has been altered today.
First, we take a look at the *
which tells us: "Return 304 if the resource is there and condition (2) is met". Fine, the resource exists, BUT condition (2) states: "Only return 304, if the date is later than current". So this condition is not met, and the page will be delivered completely.
If we hadn't received If-Modified-Since
, the response would have been 304.
If the resource hadn't existed upon request, we'd have returned the appropriate code (as if there was no If-None-Match
).
304 should only be returned in response for GET and HEAD requests, and all cache-related response headers have to be there. For all other types of request your server needs to be answering 412 (Precondition failed).
I hope it helps ;)