GitHub and animated gifs…

Estimated reading time: 1 mins

Table of contents

For our n0r1skcom/echo DockerHub image we wanted to add a gif (see above) with console output to the corresponding GitHub project README.

But that wasn’t that easy as we thought because GitHub caches images with atmos/camo and that brings in some problems with bigger gif’s…

So we had to disable image caching via the http headers of our source image but these images are located in our WordPress media library and we didn’t want to disable image caching in general.

The solution for us was to configure the serving webserver (in our case Apache) to set some caching/expiry headers via LocationMatch directive and a fancy regex. Our regex includes all pictures with the filename prefix “nocache_” - so every other image uploaded isn’t touched in any way.

Apache configuration sample

<LocationMatch "/wp-content/uploads/.*/.*/nocache_.*">
   Header set Cache-Control "no-cache"
   Header set Pragma "no-cache"
   Header set Expires "Sun, 01 Jan 1984 00:00:00 GMT"
Posted on: Tue, 25 Apr 2017 16:46:47 +0100 by Unknown
  • Webstuff