how can I force cdn.rawgit.com use updated file

2019-06-15 01:52发布

问题:

I am using cdn.rawgit.com to host some of my scripts and css for a project but I cannot refresh it. According to the FAQ:

Requests to cdn.rawgit.com are routed through MaxCDN's super fast content delivery network, and are cached permanently the first time they're loaded. This results in the best performance and reduces load on RawGit and on GitHub, but it means that reloading won't fetch new changes from GitHub.

Does this mean I can never refresh? Or is there a way to force a refresh to use the most recent version?

回答1:

Yes, permanent means never.

From the documentation:

Since files are not refreshed after the first request, it's best to use a specific tag or commit URL, not a branch URL.

This wouldn't update the file per-se, but it would allow you to specify the new version.



回答2:

I just created a page with github pages and I hosted the files there. You create a repository, in settings create the page then when you update the files it will automatically do it for you!



回答3:

It is impossible to refresh a cdn link. But there is a way of doing this.
Instead of specifying the URL directly:

https://github.com/<user>/<repo>/file.txt

you can make it tag specific like this one

https://github.com/<user>/<repo>/1.2/file.txt

So when you change the file, make a draft release and change the tag 1.2 to the tag release you made recently!



回答4:

Since rawgit.com is shutting down you want to use combinatronics.com it is an alternative for rawgit.com

It also automatically gets the latest file.



标签: github cdn