HTTP: Combining expiration and validation caching

Viewed 7086

I'm having trouble formulating HTTP cache headers for the following situation.

Our server has large data that changes perhaps a couple times a week. I want browsers to cache this data. Additionally, I want to minimize latency from conditional gets as the network is unreliable.

The end behavior I'm after is this:

  1. Client requests a resource it hasn't seen before.
  2. Server responds with resource along with ETag and max-age (24 hours).
  3. Until 24 hours has passed, client will use cached resource.
  4. After the expiration date, client will perform a validate request (If-None-Match: [etag])
  5. If resource has not changed:
    • server responds with 304 Not Modified
    • client is somehow informed that the existing resource has a new expiration date 24 hours from now
    • return to step 3

Boiled down to its essense... can a 304 response contain a new max-age? Or is the original max-age honored for subsequent requests?

1 Answers
Related