1

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.

Community
  • 1
  • 1
Max Yaskov
  • 314
  • 1
  • 11
  • 1
    Vary's main purpose is to ensure clients get the right representation of a resource, when Content Negotiation is in play. Caching isn't Content Negotiation. – CBroe Mar 31 '18 at 20:38
  • Although, the RFC clearly states that informing caches is one of the purposes of the `Vary` header field. – jsageryd Mar 31 '18 at 20:53

1 Answers1

1

No.

The 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

In this case, the representation is not determined by the value of those headers. They are used to decide whether or not a body should be sent.

As a hint:

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

Likewise for for conditional request fields.

Community
  • 1
  • 1
Joe
  • 29,416
  • 12
  • 68
  • 88