elementary / website

The elementary.io website
https://elementary.io
MIT License
1.24k stars 707 forks source link

Setup CDN fallbacks #1709

Open btkostner opened 7 years ago

btkostner commented 7 years ago

Expected behavior

When a cdn is unreachable, another one is tried so our JavaScript does not break.

Actual behavior

All our JavaScript is failing.

Steps to reproduce the behavior

  1. Break the internet.
  2. Try to download elementary.
  3. Feel sad.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/45231611-setup-cdn-fallbacks?utm_campaign=plugin&utm_content=tracker%2F10548672&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F10548672&utm_medium=issues&utm_source=github).
lewisgoddard commented 7 years ago

I'm not sure this is really necessary. JSDelivr is already 3 CDNs. Anything on a different CDN should be moved there.

A jsDelivr failure would require two enterprise CDNs to go down, plus 14 different hosting providers

https://www.maxcdn.com/blog/load-balancing-multiple-cdns-jsdelivr-works/

btkostner commented 7 years ago

There was an issue with loading jQuery mentioned in this reddit post. He said he did not use any plugin. If it's not a CDN network issue, it's probably a firewall blocking the file. :man_shrugging:

Would it make sence to have a locally hosted copy of jQuery as a fallback?

lewisgoddard commented 7 years ago

It would be interesting trying to keep all the versions in sync, especially since jsDelivr automatically updates.

btkostner commented 7 years ago

We might run into version issues, but I doubt anything breaking. I don't think jsDelivr automatically updates major versions, and the api between the minor versions shouldn't break any of our stuff.

varanauskas commented 7 years ago

How much jQuery is actually used, would it be possible to maybe rewrite at least the core functionality in vanilla JavaScript and provide graceful fallback for NoScript users and older browsers (for e.g. a person still using old browser on Windows XP)?

btkostner commented 7 years ago

Most of the jQuery usage is for ajax and for Dom manipulation of classes and html content. It's possible to rewrite it, but it's quite a lot to rewrite.

lewisgoddard commented 7 years ago

Also you'd lose a lot of the compatibility jQuery provides, we also use other libraries on CDNs for other things, including error tracking.

lewisgoddard commented 7 years ago

I still don't believe this is necessary, but if you want to fix it, #1795 is going through showing all the locations that would need fallbacks added.