Tuesday, 7 July 2015

Don't cache repomd.xml when using squid

If, like me, you try to ensure all your package update traffic goes through a caching proxy, you may occasionally have hit an issue where yum/dnf is trying to download repo metadata which doesn't exist. This can happen because your proxy is caching repomd.xml, and the cached version refers to metadata which has since been deleted.

Fortunately repomd.xml is normally very small, typically less than 4k, so the simplest solution is just not to cache it. You can do that be adding the following stanza to squid.conf:
acl repomd url_regex /repomd\.xml$
cache deny repomd