Make response-ratelimiting plugin and rate-limiting plugin return the same response when limited (or at least be more consistent). #7211
Replies: 4 comments
-
@thefosk ^ |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I just verified in kong 0.5.2 (using the AWS AMI) that if you set a response-ratelimiting limit to
This pull request #733 should fix this issue as well. |
Beta Was this translation helpful? Give feedback.
-
When rate limited, the rate-limiting plugin returns a
429
with the following response body: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.
Beta Was this translation helpful? Give feedback.
All reactions