How to force image (cache) update in README.rst on GitHub
In one of my project I'm using an external image link to display a screenshot via the GitHub page, which automatically parses the README.rst
GitHub page of ROyWeb
I updated this screenshot on my web server several times in the last weeks and I just realised that it is not updated on the GitHub page since... well I think it never updated ;-) GitHub somehow downloaded the image and loads it from it's cache servers.
Within the README.rst, there is clearly the correct link:
Actual link to the ROyWeb screenshot
Which you can confirm, when you load the raw file:
raw README.txt on GitHub
But when I check the URL of the displayed image on the GitHub page, I get:
GitHub cached screenshot of ROyWeb
Does anyone know how to force a "recache"?
curl -X PURGE {url of cached badge image}
There is also a trick that can be useful. It is nothing but just adding a question mark at the end of the image extension.
![This is an automated blog post image using Azure Function](https://customurl.blob.core.windows.net/github/latestpost.png?)
See the question mark (?) at the end. You can also see the live example here in my GitHub profile.
You can see more about this here.
I had a look at what shields.io does.
It sets this header (Source):
Cache-Control: max-age=2592000