Closed eliyahu2 closed 2 years ago
@eliyahu2 Hey, the X-Rate-Limit-*
headers can be used to check your rate limit. For example, if you don’t have any -Remaining
requests, you can calculate the number of seconds using -Reset
until you can send another request that won’t be rate-limited.
Does that answer your question?
Hi! Thank you for your quick response, actually We're looking to know:
Can the X-Rate-Limit-* flags be removed? is it crucial for the rate limiter to work?
In the case that it can be removed, how can it be done? We've tried settings the response.header('X-Rate-Limit-Limit', null) during the "OnPreResponse" stage of hapi but it can still be shown in the browser.
Thank you very much for your assistance
@eliyahu2 At this point, there’s no option to disable the rate-limiting headers when rate-limiting applies to a route. If I remember correctly, this plugin won’t set these response headers if a route is not rate-limited.
My approach to remove the headers if you don’t want them:
onPreResponse
extension point after the hapi-rate-limitor
plugin has been registeredassignHeaders
method of this plugin how to set a response header in hapinull
or undefined
@marcuspoehls Thanks That's very helpful!
Nice 😊🤜🤛
@eliyahu2 I saw you reopened this issue. Do you need help?
Is there a way to hide those in the response or are those required? what are they used for? there is no documentation for why they are set besides a simple note...
Plus, trying to remove them in "onReponse" by setting them to null doesn't work, how can it be done?
Thanks