CS FundamentalsHardProduct-company placement · web

A shared cache stores a response from origin that carries Vary: Accept-Encoding. A later client asks for the same URL with a different Accept-Encoding value. What should the cache do?

  1. A. Serve the stored copy, because the URL alone is the cache key
  2. B. Serve the stored copy and add a Warning header naming the encoding difference
  3. C. Recompress the stored body into the new encoding and then serve it
  4. D. Treat it as a miss unless it holds a variant stored for that Accept-Encoding

Correct answer: D. Treat it as a miss unless it holds a variant stored for that Accept-Encoding

Vary makes the listed request headers part of the cache key, so a gzip variant must not be served to a client that asked for identity or br. Ignoring Vary is a classic cause of browsers getting compressed bytes they cannot decode.

More Computer Networks questions

Exams that ask this topic