Google Chrome does not revalidate etag on back/forth

后端 未结 3 537
逝去的感伤
逝去的感伤 2020-12-14 10:59

Even though I send \"cache-control: must-revalidate\" Google Chrome uses a locally cached page when using the back and forth button in the browser.

This is part of t

3条回答
  •  心在旅途
    2020-12-14 11:57

    The "must-revalidate" directive applies only after the response is stale (RFC2616, sec 14.9.4). Since the response contains neither an "Expires" header nor a "max-age" directive, the browser might have treated the response as still fresh and accordingly returned the cached copy. To prevent this you should include "max-age: 0" in the Cache-Control header (and possibly an Expires header containing a date in the past), so that the cached response becomes stale immediately. Alternatively, to prevent caching, use the "no-cache" directive instead of "must-revalidate".

提交回复
热议问题