Allow use external CDN service to provide public static files. #4412

Closed
opened 2025-11-02 05:49:51 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @lunny on GitHub (Nov 28, 2019).

Many famous static files have been served by https://cdnjs.com/ for free. For those files a private CDN service is unnecessary. Below list all files could be served.

  • vue.min.js
  • jquery.min.js
  • semantic.min.js
Originally created by @lunny on GitHub (Nov 28, 2019). Many famous static files have been served by https://cdnjs.com/ for free. For those files a private CDN service is unnecessary. Below list all files could be served. - [ ] vue.min.js - [ ] jquery.min.js - [ ] semantic.min.js
GiteaMirror added the type/proposal label 2025-11-02 05:49:51 -06:00
Author
Owner

@silverwind commented on GitHub (Nov 29, 2019):

I'd prefer to bundle them instead. Less HTTP requests is always faster and external sources may be a privacy concern to some. I certainly prefer to have my instance work standalone, even when a external service is unreachable or down.

@silverwind commented on GitHub (Nov 29, 2019): I'd prefer to bundle them instead. Less HTTP requests is always faster and external sources may be a privacy concern to some. I certainly prefer to have my instance work standalone, even when a external service is unreachable or down.
Author
Owner

@lunny commented on GitHub (Nov 29, 2019):

@silverwind This will be a configurable feature and default is local assset files.
We have at least two scenios, one for private instance, one fore public instance.
For a public instance, reference a CDN static maybe faster then himself service.

And I think we should only bundle ourself js/css but keep third-party standalone js/css for more flexsible maintainances.

@lunny commented on GitHub (Nov 29, 2019): @silverwind This will be a configurable feature and default is local assset files. We have at least two scenios, one for private instance, one fore public instance. For a public instance, reference a CDN static maybe faster then himself service. And I think we should only bundle ourself js/css but keep third-party standalone js/css for more flexsible maintainances.
Author
Owner

@silverwind commented on GitHub (Nov 29, 2019):

The speed difference would only be visible on the very first page load. After that, serviceWorker will cache all asset requests and serve them from local cache instead of CDN.

So I don't think there's really any benefit in doing external sources except that they prevent future bundling attempts.

See this screenshot for the service worker in action. There is no transfer time on them because the network is never hit on those requests.

@silverwind commented on GitHub (Nov 29, 2019): The speed difference would only be visible on the very first page load. After that, `serviceWorker` will cache all asset requests and serve them from local cache instead of CDN. So I don't think there's really any benefit in doing external sources except that they prevent future bundling attempts. See this screenshot for the service worker in action. There is no transfer time on them because the network is never hit on those requests. <img width="1234" src="https://user-images.githubusercontent.com/115237/69845880-782ce000-1272-11ea-9a5c-080b602f6785.png">
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4412