RawGit - Convert GitHub Files into Raw CDN Assets

RawGit serves raw files directly from GitHub with proper Content-Type headers.

In production


  • No traffic limits or throttling. Files are served via StackPath's super fast global CDN.
  • Use a specific tag or commit hash in the URL (not a branch). Files are cached permanently based on the URL. Query strings are ignored.
  • The catch: this is a free service, so there are no uptime or support guarantees.

For development


  • New changes you push to GitHub will be reflected within minutes.
  • Excessive traffic will be throttled and blacklisted.
  • If excessive traffic continues, RawGit will display a prominent error message on your website to try to get your attention.

Why is this necessary? Can't I just load files from GitHub directly?

When you request certain types of files (like JavaScript, CSS, or HTML) from raw.githubusercontent.com or gist.githubusercontent.com, GitHub serves them with a Content-Type header set to text/plain. As a result, most modern browsers won't actually interpret these files as JavaScript, CSS, or HTML and will instead just display them as text.

GitHub does this because serving raw files from a git repo is inefficient and they want to discourage people from using their GitHub repos for static file hosting.

RawGit acts as a caching proxy. It forwards requests to GitHub, caches the responses, and relays them to your browser with an appropriate Content-Type header based on the extension of the file that was requested. The caching layer ensures that minimal load is placed on GitHub, and you get quick and easy static file hosting right from a GitHub repo. Everyone's happy!

Read more http://rawgit.com/

No comments:

Post a Comment