Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blackList ips status code #3

Closed
tunnckoCore opened this issue May 10, 2014 · 3 comments
Closed

blackList ips status code #3

tunnckoCore opened this issue May 10, 2014 · 3 comments
Assignees
Labels

Comments

@tunnckoCore
Copy link

blackList: all ips in blackList will 403., but it's still 429 on line 67 :)
And why all is in milliseconds? If I'm not mistaken, Retry-After header gets seconds and
Github's rate_limit response also is in seconds?

@dead-horse dead-horse added the bug label May 10, 2014
@dead-horse dead-horse self-assigned this May 10, 2014
@dead-horse
Copy link
Member

got it

@tunnckoCore
Copy link
Author

Hah, fast response.. but.
Yea big "BUT". But X-RateLimit-Reset always updates - in every request. Refresh-After also shuffles.

tunnckoCore@grith ~/node $ curl -I -X GET http://localhost:3000/test
HTTP/1.1 200 OK
X-Powered-By: koa
X-RateLimit-Limit: 5
X-RateLimit-Remaining: 2
X-RateLimit-Reset: 1399695408
Content-Type: text/plain; charset=utf-8
Content-Length: 124
Date: Sat, 10 May 2014 04:16:48 GMT
Connection: keep-alive

tunnckoCore@grith ~/node $ curl -I -X GET http://localhost:3000/test
HTTP/1.1 200 OK
X-Powered-By: koa
X-RateLimit-Limit: 5
X-RateLimit-Remaining: 1
X-RateLimit-Reset: 1399695409
Content-Type: text/plain; charset=utf-8
Content-Length: 124
Date: Sat, 10 May 2014 04:16:49 GMT
Connection: keep-alive

tunnckoCore@grith ~/node $ curl -I -X GET http://localhost:3000/test
HTTP/1.1 200 OK
X-Powered-By: koa
X-RateLimit-Limit: 5
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1399695410
Content-Type: text/plain; charset=utf-8
Content-Length: 124
Date: Sat, 10 May 2014 04:16:50 GMT
Connection: keep-alive

tunnckoCore@grith ~/node $ curl -I -X GET http://localhost:3000/test
HTTP/1.1 429 Too Many Requests
X-Powered-By: koa
X-RateLimit-Limit: 5
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1399695411
Retry-After: 278
Content-Type: text/plain; charset=utf-8
Content-Length: 25
Date: Sat, 10 May 2014 04:16:51 GMT
Connection: keep-alive

tunnckoCore@grith ~/node $ curl -I -X GET http://localhost:3000/test
HTTP/1.1 429 Too Many Requests
X-Powered-By: koa
X-RateLimit-Limit: 5
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1399695432
Retry-After: 193
Content-Type: text/plain; charset=utf-8
Content-Length: 25
Date: Sat, 10 May 2014 04:17:12 GMT
Connection: keep-alive

As you can see, every time Retry-After is random number. And note first, second and third request's X-RateLimit-Reset.
My implementation of rate limits is in 49 rows, with in-memory store.

@tunnckoCore
Copy link
Author

https://github.com/tunnckoCore/koa-better-ratelimit - only with MemoryStore.
Better, smaller, tested, working. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants