两个 header Cache-control: max-age=0
和 Cache-control: max-age=-1
之间的浏览器行为有何不同?
如果浏览器收到 max-age=0,它会立即重新验证缓存。 如果浏览器收到 max-age=10,它将在 10 秒后重新验证缓存。 max-age=-1 时浏览器的行为是什么?是否与 max-age=0 一样?如果是,为什么我们需要两者?
最佳答案
max-age
采用匹配 delta-seconds
的参数:
The delta-seconds rule specifies a non-negative integer, representing
time in seconds.
delta-seconds = 1*DIGIT
max-age=-1
因此不是有效的指令,规范也没有定义解释。规范建议:
Caches are
encouraged to consider responses that have invalid freshness
information to be stale.
关于http - 缓存控制中的 max-age=0 和 max-age=-1 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47470325/