How to prevent Github from caching images in markdown files #22283
-
I’m trying to add an image to a markdown file in my repo. The server updates the image every minute, but the image is cached by Github and therefore does not update in the readme. I’m sending a cache-control header from a .htaccess file which looks like this:
I have limited understanding of caching, but I’ve noticed that Github Pages doesn’t cache the image when building the site, but it still caches the image in the readme. Original picture (updated once per minute) Checking the Network tab on Chrome shows that the original image is sending this request header:
Cached by Github
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @paramt When I fetch your source image, I get no Cache-Control headers.
|
Beta Was this translation helpful? Give feedback.
-
I finally figured it out and it wasn’t a problem with Github, but rather with my response headers (as @seveas pointed out). My .htaccess file wasn’t being recognized. |
Beta Was this translation helpful? Give feedback.
I finally figured it out and it wasn’t a problem with Github, but rather with my response headers (as @seveas pointed out). My .htaccess file wasn’t being recognized.