System Design · Senior · Question 21 of 75

Why is a Vary: User-Agent or Vary: Cookie header dangerous for a CDN?

Explanation

Vary adds request headers to the cache key. User-Agent and Cookie are nearly unique per visitor, so the cache becomes useless. Normalize the key (device class instead of the full UA) and move personalization out of the cached response.

Further reading

Problem with a question

System Design · Senior · question 21

Test yourself

Take the System Design · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz