我应该指定 "Vary: If-None-Match, If-Modified-Since" 吗?

Should I specify "Vary: If-None-Match, If-Modified-Since"?

RFC 7231:

The "Vary" header field in a response describes what parts of a
request message, aside from the method, Host header field, and
request target, might influence the origin server's process for
selecting and representing this response.

没有

RFC says:

An origin server SHOULD send a Vary header field when its algorithm for selecting a representation varies based on aspects of the request message other than the method and request target

在这种情况下,表示不是由那些 headers 的值决定的。它们用于决定是否应发送 body。

提示:

For example, there is no need to send the Authorization field name in Vary because reuse across users is constrained by the field definition

同样适用于条件请求字段。