0
votes

I ready the RFC 7234 Cache-Control documentation. But it's not clear for me what would be the behavior of a resource where the request header set max-age to 0 but the response header have the max-age=3600.

  • Modifications of the basic expiration mechanism; these may be imposed by either the origin server or the user agent.

But which one would take effect?

  • Controls over cache revalidation and reload; these may only be imposed by a user agent.

Is max-age this kind of control? If yes, the request header would take effect.

1
Does this answer your question? Why cache-control HTTP header for requests?Joe

1 Answers

1
votes

Although the header may have the same name, the role of Cache-Control in the request and response is different. Both are used by a cache, when it is either deciding whether a request needs to be sent to the origin server, or whether it can store the response for future use.

what would be the behavior of a resource where the request header set max-age to 0 but the response header have the max-age=3600

A request with max-age=0 indicates that a client requires a new response. The cache would forward the request to the origin server.

A response header of max-age=3600 would be stored along with the response in any caches, and returned to the client. It would be compared against any future requests to determine whether this response is still fresh enough for that client.