Vary header

The response header that lists which request headers changed the answer, so caches keep separate copies for each value.

In more detail

Without it, a cache could store the JSON answer for one caller and serve it to another who asked for something else. Caches then store one copy per value of each listed header, such as one per Accept or one per Origin.

Example

In the APIs course: The course service sends Vary: Accept on negotiated answers and Vary: Origin on CORS preflights, and a partial response must vary on the field choice.

Related terms

Taught in

References