When you request a file from
They do this because serving raw files from a git repo is relatively inefficient, so they want to discourage people from using their GitHub repos for static file hosting.
RawGit acts as a caching proxy, forwarding requests to GitHub, caching the responses either for a short time (in the case of
rawgit.com URLs) or permanently (in the case of
cdn.rawgit.com URLs), and relaying them to your browser with the correct
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!
No, RawGit is not associated with GitHub, Inc. in any way. Please don't contact GitHub asking for help with RawGit. They'll give you a weird look and back away slowly.
When you make a request to a
rawgit.com URL, the RawGit server loads the requested file from GitHub, serves it to your browser with the correct
Content-Type header, and caches it for a short time. If you push new changes to GitHub, you can reload and see them within a few minutes, which makes
rawgit.com useful for low-traffic testing or sharing demos during development.
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.
During development, when traffic is low and freshness is more important than performance, use
rawgit.com. For anything you share with the public or push to production, use
No. Please use
cdn.rawgit.com for anything that might result in heavy traffic. Only use
rawgit.com URLs for low-traffic testing and sharing temporary examples or demos during development. When people misuse
rawgit.com, it costs me money. Please don't be a jerk.
First, requests will be throttled and your site will start to load very slowly. If the traffic continues even after automatic throttling is triggered, rawgit.com will start serving an error page instead of the requested file. If traffic reaches truly excessive levels, then an error message may be displayed directly on your website asking your users to notify you of the problem.
This is designed to get your attention as quickly as possible before the excessive traffic becomes a major problem for RawGit and starts costing me large amounts of money or impacting other users of this service.
Remember, only use
cdn.rawgit.com in production; never
The CDN caches files permanently based on their path. It ignores query strings. This is done both to improve performance and to make it possible for the CDN to handle massive amounts of traffic without causing excessive load on RawGit or GitHub's servers.
To ensure that the CDN always serves the version of the file you want, use a git tag or commit ref in the file's path instead of a branch name, and update the URL if you push a new version of the file.
So, instead of a URL like
https://cdn.rawgit.com/user/repo/branch/file, use a URL like
RawGit is a free service and cannot provide any uptime or support guarantees, even for
cdn.rawgit.com. While I do my best to keep things running, things sometimes go wrong. Sometimes there are network or provider issues outside my control, sometimes abusive traffic temporarily affects response times, and sometimes I break things (although I try really hard not to).
Since I run RawGit in my spare time, with my own money and with CDN hosting generously donated by MaxCDN, it has a budget that's probably less than you pay for coffee in a given month. My goal is to help other open source developers get their projects up and running, but if you need to serve files that are crucial to your business, you should probably pay for a host with well-funded infrastructure and uptime guarantees.
I moved a file in my repo and now old RawGit URLs are broken. Is there any way to redirect to the new file?
There sure is (for non-CDN URLs, anyway). But in the future, you might want to consider using URLs based on a tag or commit ref rather than a branch, since tags and commits always represent a single point in time and won't break if you move a file later.
It's super nice of you to offer, but I don't need any donations at this time. RawGit's server costs are minimal, and the lovely people at MaxCDN provide RawGit's CDN service free of charge. Thank you though!
To report a critical issue like RawGit being broken or to share general feedback, send a tweet to @rawgit or @yaypie. I try to respond quickly when I'm awake and near a computer, but sometimes I do have to sleep. To report a non-critical bug, please file an issue.
To report a security concern, please email email@example.com privately. Feel free to encrypt your email using my public key if you're paranoid. Expect a response within 48 hours.