How to setup Rate Limiting plugin for Consumer

I’m add new Rate Limiting plugin for Consumer (I’m not hide_client_headers), result like image below:


but when I call api, response header not show any tag of Rate Limiting like:
X-RateLimit-Limit-Second: 5
X-RateLimit-Remaining-Second: 4
X-RateLimit-Limit-Minute: 10
X-RateLimit-Remaining-Minute: 9
I got response header like image below:

I think I’m wrong when configuration or Rate Limiting for Consumer not working.
Can you point me wrong and show me how to do?
Thanks in advance!

Hi there. Here is an example of using rate-limiting plugin with a consumer:

http POST :8001/services name=testService protocol=http host=mockbin.org port:=80 path=/request
http POST :8001/services/testService/routes name=testRoute protocols:='["http"]' paths:='["/echo"]'
http POST :8001/routes/testRoute/plugins name=key-auth
http POST :8001/consumers username=testUser
http POST :8001/consumers/testUser/key-auth key=123Testing!
http --form POST :8001/consumers/testUser/plugins name=rate-limiting config.second=12
http GET :8000/echo?apikey=123Testing! --print=h

As you can see, relevant headers are present:

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: host,connection,x-forwarded-for,x-forwarded-proto,x-forwarded-host,x-forwarded-port,x-real-ip,x-forwarded-prefix,user-agent,accept-encoding,accept,x-consumer-id,x-consumer-username,x-credential-identifier,x-request-id,via,connect-time,x-request-start,total-route-time
Access-Control-Allow-Methods: GET
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Thu, 31 Dec 2020 01:05:13 GMT
Etag: W/“480-elBu9XGRHmjgyRE2rPMZEyBD4mE”
Kong-Cloud-Request-ID: 3105b1b0e0267785e061df660ce1a450
RateLimit-Limit: 12
RateLimit-Remaining: 11
RateLimit-Reset: 1
Server: Cowboy
Transfer-Encoding: chunked
Vary: Accept, Accept-Encoding
Via: kong/1.5.0.3-enterprise-edition
X-Kong-Proxy-Latency: 0
X-Kong-Upstream-Latency: 17
X-Kong-Upstream-Status: 200
X-Powered-By: mockbin
X-RateLimit-Limit-Second: 12
X-RateLimit-Remaining-Second: 11

Regards
Arash

I’m not apply your solution but it make me know how to config.
Thank you very much


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ