I'm currently running squid-deb-proxy to cache apt-related downloads, I was wondering if the same could be done with snaps as well.
The squid-deb-proxy works because the files are served over plain HTTP, and generally do not require authentication (ones that do are usually over HTTPS and tend to not be cached).
Snaps however, are served over HTTPS due to the inherent requirements of authenticating to the store, and the possibility that some snaps are for purchase, and similar situations. To cache the data via a proxy, you will need to break the TLS connection by creating a certificate which you own, and which can be seen as valid by snapd when it attempts to verify the certificate.
At the first glance Ubuntu has Snap Store Proxy but then if you'd look closer into it you'll realise they expect that:
- you shall tinker with Postgresql
- configure some un-explained "domain name"
- generate keys and then register this proxy
- wait till they approve it
and only then you'd be able to save time and traffic with caching… "For evaluation purposes, we automatically grant the use of up to 5 devices."