0

I need to know what should happen when set different value to request max-age and response max-age for example
in server response: res.setHeader("Cache-Control", "max-age=3600")

in client request: Cache-Control: max-age=60

when I try that I thought that after 60 second the response should considered stall by the browser and send a new request but it did not. it kept use the cache. but when I set max-age to 0 in request it does as expected and did not use the cache.

So my question is what is the difference between set max-age=0 and to any number else (eg:60) in request cache-control header

M7mod Bakr
  • 127
  • 5
  • 1
    [Here](https://datatracker.ietf.org/doc/html/rfc7234#section-5.2.1.1) is the relevant part of the specification. As you expect, if you use `Cache-Control: max-age=60` in the request you should not receive a cached response older than 60 seconds. – Kevin Christopher Henry Sep 25 '22 at 11:46
  • Does this answer your question? [what does setting Cache-Control: max-age=20 in request header do?](https://stackoverflow.com/questions/70034498/what-does-setting-cache-control-max-age-20-in-request-header-do) – Joe Sep 26 '22 at 11:21
  • @joe unfortunately not, as that answer explain the normal expected behavior that I myself expected. but the issue here is when I set the max-age to 30 in the request and try the same request after 30 seconds it did not revalidate – M7mod Bakr Sep 26 '22 at 11:53
  • @M7modBakr then your question would seem to be about a specific browser implementation, rather than the spec. It's worth adding that detail. – Joe Sep 26 '22 at 13:41

0 Answers0