pfSense Caching / Squid

I’m building a pfSense box (pcengines apu3) for the family’s holiday home that will connect over 4G to the Internet and VPN to access a Synology NAS.

The 4G WWAN is data-capped so I want to set up caching to get better speeds and lower costs. Normally the NAS would be accessed over SAMBA to view media files such as pictures and video. From what I’ve read Squid proxy does not cache SAMBA but I could probably use a protocol like FTP instead.

With regard to other caching there isn’t much HTTP content around so I’m considering TLS/SSL interception and caching but I’m not sure if that’s worth the bother of telling people to install the proxy’s certificate authority. There are also some privacy implications with regard to this but let’s say I could limit the scope of this to media heavy sites with news and video streaming.

At the same time I’m not sure how realistic caching dynamic content and a plethora of possible video sizes is like that offered by YouTube and to which extent this would actually work and reduce data usage.

Anyway, I’m wondering if anyone has made similar setups and how you went about doing this? In my case caching FTP from the NAS might be most sensible.

For YouTube, I wonder how useful it’d be. How often do you watch the same video twice?

At least you’ll be able to get some accounting if you try to intercept traffic with squid, you can choose to substitute certs based on the client device - making it possible to not “break” and not “require” clients to do anything.

I think it’s probably inevitable that you end up having to involve nginx with lua or similar to do effective caching of large content.


For file systems, the issue is always cache invalidation and conflict resolution.

For example, you can pre-seed the contents of Synology locally and use syncthing to keep things up to date incrementally. There was a syncthing fuse effort at one point, that sounds perfect for your use case, I’m not sure where that went or whether it still works.

If you have mostly immutable data, you could fuse mount ipfs on your cache server and have another local samba serving files over that. I’m not sure how well that works for ipns.

Microsoft has a thing called BranchCache, I guess it’s similar to FS-Cache on Linux (RedHat has docs about it).

Setting up a proxy server to save data usage on today’s internet, where pretty much everything is on HTTPS, is almost certainly a waste of time.

I mean, there are some small gains to be found but I suspect these will be overwhelmed by a couple of YouTube videos.

Pihole or some other form of ad blocking probably a good idea though.

If you want to cache Samba Windows has an integrated client side cache. That only works on a per-machine basis but if you only have one client (or the repeated access to a given set of files comes from one client per set) that could work.

You could just do the netflix thing and hook up an external USB drive to your router in the holiday home and share it locally there.