Xmlhttprequest: How To Force Caching?
Solution 1:
You can specify max-stale
without an argument, in Cache-Control
header of your request. From RFC 7234:
The
max-stale
request directive indicates that the client is willing to accept a response that has exceeded its freshness lifetime. Ifmax-stale
is assigned a value, then the client is willing to accept a response that has exceeded its freshness lifetime by no more than the specified number of seconds. If no value is assigned tomax-stale
, then the client is willing to accept a stale response of any age.
Solution 2:
There are a variety of headers you can set to encourage caching, but they (including Cache-Control
which you are using incorrectly) are response headers that must be sent by the server and not request headers.
One such example of using Cache-Control:
Cache-Control: max-age=3600
This Caching Tutorial for Web Authors and Webmasters covers them in more depth.
Solution 3:
Please check Caching static assets
Cache-Control: public, max-age=604800, immutable
Post a Comment for "Xmlhttprequest: How To Force Caching?"