![]() ![]() Those are the abstract technical reasons. If you have large cookies stored for your domain, this creates a lot of unnecessary data sent in every request to your domain, again unnecessarily increasing bandwidth usage and load times (honestly I'm not sure if this overhead really had a practical impact, but it was certainly widely documented as an important 'web best practice'). Lastly, the main site's cookies aren't sent in requests to 3rd party domains. By using a separate domain for some resources, resource loading could be spread across more connections, improving load times for visitors. Browsers limit the number of simultaneous open connections by domain, which limits the performance of parallel resource downloads. In effect, sites could share resources (almost always JavaScript) between one another to improve caching, reduce load times, and save bandwidth for sites and visitors.Įven in the uncached case, this still offered benefits. If you used a popular version of jQuery then you could reference it from a public CDN URL, and if a user had recently visited another site that used the same version of jQuery from the same CDN then it would load instantly, straight from their cache. The main benefit that public CDNs of popular libraries offered was shared caching. First though, why was this a good idea, and how has it now become such a mess? Why was this a good idea? I'll explain what that means in a second. There are ways to mitigate those risks, but in practice the best solution is to avoid them entirely: self-host your content and dependencies, and then use your own caching CDN directly in front of your application instead for performance. Just last week, a security researcher showed how this could go horribly wrong. Nowadays, it's become a recipe for security, privacy & stability problems, with near-zero benefit. ![]() Once upon a time, loading common scripts & styles from a public CDN like cdnjs or Google's Hosted Libraries was a 'best practice' - a great way to instantly speed up your page loads, optimize caching, and reduce costs. ![]()
0 Comments
Leave a Reply. |