Assume I have image available at www.example.com/path/to/image.png - base URL.
Then, after updating image on backend, I’m doing
PURGE www.example.com/path/to/image.png to invalidate cached version and read updates from backend. And now new image served.
But for links like
[base URL]?p1=v1&p2=v2 (base URL with parameters) it still serve “old” content if that request was made before. Parameters may vary and in general not under our control.
Question:
How I can do PURGE to invalidate all URL’s for base address, disregarding any query parameters?
Hi @alex_anisov – the short answer is that you must configure your service to do this beforehand. It’s not possible to do this after objects are already in cache.
The simplest way to do this is by creating a surrogate key for specific paths via the req.url.basename
or by some other criteria, then purge the key.
Once this logic is in production, new requests will be cached with the surrogate key logic, but it won’t apply retroactively to objects that have been previously cached.
2 Likes
@aspires
Had something similar in the mind, thank you for confirmation.
1 Like