Closed ljcbaby closed 2 years ago
Totals | |
---|---|
Change from base Build 1524610652: | 0.0% |
Covered Lines: | 138 |
Relevant Lines: | 141 |
Please dont use the undocumented jsDelivr endpoints. They exist only for internal use and can be removed and stop working at any moment. Only cdn.jsdelivr.net is production ready
@jimaek Thanks for the reminder. I added these mainly to address the accessibility of jsDelivr in mainland China after losing the mainland China endpoints. According to my partial experiments, Fastly has better speed in mainland China, but Cloudflare has better access success rate.
AS #424.We are also considering adding public CDNs in mainland China with unpkg or CDNJS as their upstream to deal with this impact.
My personal opinion: this outbreak may be related to the abuse of jsDelivr by some users in mainland China through Github.
The outage was a one time unique event we had no control over. Loss of ICP license. Now that we use regular CDN providers our regular failover systems will work. So jsDelivr is still better than unpkg or cdnjs who simply use Cloudflare with no failover or routing optimization.
@jimaek I don't think we can be overly optimistic, the network environment in mainland China is complex and this incident will definitely affect the accessibility of jsDelivr.
@ljcbaby Nice PR, works for me, but not well.
https://www.chengxiaobai.com/trouble-maker/customize-cdn-provider-for-hexo-theme-next
@njzjz Couldn't agree more.
@ljcbaby Nice PR, works for me, but not well.
https://www.chengxiaobai.com/trouble-maker/customize-cdn-provider-for-hexo-theme-next
@njzjz Couldn't agree more.
Thank you for your suggestion.
This pr is for webmasters who still want to try jsDelivr but want to get a better access experience in mainland China for debugging.
We discuss the introduction of a public CDN for mainland China in #424.
As well, I'm personally opposed to modifying the theme files directly, which may cause long term maintenance problems.
How about adding a new option like:
custom_cdn_url: 'https://fastly.jsdelivr.net/npm/${name}@${version}/${file}'
And we parse it like this:
str.replace(/\$\{(.+?)\}/g, (match, p1) => obj[p1])
@stevenjoezhang Good method, this also can give each websitemaster better freedom.
But how to solve preconnect ?
Maybe url.parse(config.custom_cdn_url).hostname
?
I seem to be unable to complete this one, I haven't learn JavaScript.
PR Checklist
PR Type
What is the current behavior?
Issue resolved:
What is the new behavior?
Add options for custom CDN providers.
How to use?
In NexT
_config.yml
: