I have a page /data.txt
, which is cached in the client's browser. Based on data which might be known only to the server, I now know that this page is out of date and should be refreshed. However, since it is cached, they will not re-request it for a long time (until the cache expires).
The client is now requesting a different page /foo.html
. How can I make the client's browser re-request /data.txt
and update its cache?
This should be done using HTTP or HTML (not all clients have JS).
(I specifically want to avoid the "cache-busting" pattern of appending version numbers to the /data.txt
URL, like /data.txt?v=2
. This fills the cache with useless entries rather than replacing expired ones.)
Edit for clarity: I specifically want to cache /data.txt
for a long time, so telling the client not to cache it is unfortunately not what I'm looking for (for this question). I want /data.txt
to be cached forever until the server chooses to invalidate it. But since the user never re-requests /data.txt
, I need to invalidate it as a side effect of another request (for /foo.html
).