Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Make response-ratelimiting plugin and rate-limiting plugin return the same response when limited (or at least be more consistent). #732

Closed
nricklin opened this issue Nov 20, 2015 · 4 comments
Labels
task/feature Requests for new features in Kong

Comments

@nricklin
Copy link

When rate limited, the rate-limiting plugin returns a 429 with the following response body:

{"message":"API rate limit exceeded"}

However the response-ratelimiting plugin returns a 429 but with a blank response body.

I propose to make response-ratelimiting return the same message, I assume simply by tweaking this line to include a message:
https://github.com/Mashape/kong/blob/923639ba45253108a0a1940cd359bbb93f58128b/kong/plugins/response-ratelimiting/header_filter.lua#L54

I think it offers a more consistent experience for API users to see the same error message when rate limited.

I'll do a pull request if it makes sense to others.

@sonicaghi
Copy link
Member

@thefosk ^

@thibaultcha thibaultcha added task/feature Requests for new features in Kong area/plugins labels Nov 21, 2015
@thibaultcha
Copy link
Member

Sounds good to me, the only exception being that the response-ratelimiting plugin is supposed to be renamed "quotas" as per #579, so the response should probably be:

{"message":"API quota exceeded"}

PRs welcome, indeed

nricklin pushed a commit to nricklin/kong that referenced this issue Nov 21, 2015
…ests via access.lua, not header_filter.lua
@nricklin
Copy link
Author

Alright, it's in there in pull request #733 with a response of:

{"message":"API quota exceeded"}

It was a bit more than that one-liner. I had to move the blocking response from the header_filter to the action part of the plugin.

@nricklin
Copy link
Author

I just verified in kong 0.5.2 (using the AWS AMI) that if you set a response-ratelimiting limit to N, then this will happen:

  • The first N requests make it through correctly
  • Request N+1 does in fact hit the upstream server, but the response from kong is 429.

This pull request #733 should fix this issue as well.

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
task/feature Requests for new features in Kong
Projects
None yet
Development

No branches or pull requests

5 participants