API Design · Middle · Question 25 of 75
Why is the Vary header important for caching API responses?
- 1It sets the cache duration
- 2It enables compression
- ✓Correct answer: It tells caches which request headers change the response (e.g.
Accept-Language,Authorization), so different variants aren't mixed up
Explanation
Missing Vary can make a CDN serve a German response to an English user, or one user's data to another.