hasura / hasura/graphql-engine

Improve rate limit response headers

Open
#9,705 0 comments 0 reactions 0 assignees View on GitHub
k/enhancement t/gql-services
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Is your proposal related to a problem?

When rate limits are enabled within Hasura, there is no way for clients to determine additional details based on the response that is returned.

The response when you hit the rate limit looks like the below, however users do not know how close they are to the limit until they hit it:

```
{
"errors": [
{
"extensions": {
"code": "rate-limit-exceeded",
"path": "$"
},
"message": "rate limit of 10 exceeded"
}
]
}
```

### Describe the solution you'd like
As an Github uses the following headers:
X-RateLimit-Limit: The maximum number of requests you're permitted to make per hour.
X-RateLimit-Remaining: The number of requests remaining in the current rate limit window.
X-RateLimit-Reset: the time at which the current rate limit window resets in UTC epoch seconds

It would be nice if the Hasura platform included headers which provide users with guidance on how close they are getting to their role based rate limit.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.