简体   繁体   中英

Github API rate limit on public Github Pages Site

I've setup a github pages site here: http://d3js.live

This uses the github api to get gists for d3.js examples. The end look and functionality is similar to this site: http://threejs.live

I'm getting a 403 error due to my rate limit being hit. I understand that authenticating will increase my rate limit, however I'd like this site to be public. Because of this, I have a few questions:

  1. Any rate limit would be an issue if the traffic were to increase. Is there a reasonable scenario where I can disable the rate limit for a public page?
  2. If I were to authenticate with my user account, how would I create a server-side token on Github pages? I want to confirm that this token won't be visible to the client. The repo is here: https://github.com/ekatzenstein/d3.js-live
  3. Having the end user login with Github isn't an option. I want this to be a low-level of entry, especially for those not familiar with Github. Is it possible to tie the rate-limit per user?

Mike Bostock's bl.ocks seems to get around the rate limit but it's not clear to me how this is done.

The best way to get around the limit is to write a simple back-end that makes the API requests to GitHub (or whoever), cache those results for some time to remain below the rate limit, and then serve all the required assets from that request to your users.

If your JavaScript is polymorphic, it should be fairly trivial to put most of what you already have in a NodeJS server.

As a general rule, this is probably what a tool like this should do, anyway. Of course, given the trade-off required, arguments could be made either way.

This is what bl.ocks seems to do, for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM