LocalCDN possible use with IPFS

I recently came across this project LocalCDN. I haven’t figured out how they get the local resources. I think it’s just packaged with the extension but I thought that it would be really nice if it would pull resources from IPFS.

1 Like


yes that can be intresting.



Their Git page gives a little bit more information on how it works. Quote:

LocalCDN uses redirection for certain requests. There is a mapping file that lists the source (all CDNs and the path to the frameworks) and a resource file that defines the destination.

Currently only JavaScript and CSS files are redirected. However, some CSS files internally refer to other files, e.g. Font Awesome. All requests are redirected to a local file, e.g. jQuery. This is the reason why the extension is currently 10 MB in size. Only if LocalCDN cannot find a local resource (and the option is enabled), a request will be blocked.

An adblocker (e.g. uBlock Origin, uMatrix or AdGuard) decides which requests are allowed. Only if your adblocker allows a request, it will be intercepted by LocalCDN. LocalCDN catches the request after an adblocker and not before.

While it looks cool on the surface, the way this is structured is storing all data locally in the extension. Thus the extension is, like they say, rather big!

But here’s an interesting thought for this project. As this extension exists and intercepts scripts, you can probably modify it with not much effort to simply get the file from IPFS.

The trouble you’ll probably find yourself in is when you try to get a file that isn’t in your local IPFS (and perhaps not even on IPFS at all). Then you’d be waiting till a timeout hits which will make your site extremely slow. So you’d have to solve that in a smart way.