Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to set the kong plug-in rate-limiting

Shulou Source: shulou.com Published: 2022-06-01 10:50:08 10月03日 Update

This article mainly introduces "how to set kong plug-in rate-limiting". In daily operation, I believe many people have doubts about how to set up kong plug-in rate-limiting. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to set kong plug-in rate-limiting". Next, please follow the editor to study!

Set global plug-in rate-limiting. The number of requests per minute is 5. Data is stored in local memory.

Curl-I-X POST http://localhost:8001/plugins\-- data "name=rate-limiting"\-- data "config.minute=5"\-- data "config.policy=local" HTTP/1.1 201 CreatedDate: Fri, 31 Jul 2020 08:23:16 GMTContent-Type: application/json Charset=utf-8Connection: keep-aliveAccess-Control-Allow-Origin: * Server: kong/2.1.0Content-Length: 497X-Kong-Admin-Latency: 10 {"created_at": 1596183796, "id": "5beb7c20-b8a3-4fb1-a0b1-2a6b5ed9af20", "tags": null, "enabled": true, "protocols": ["grpc", "grpcs", "http", "https"], "name": "rate-limiting", "consumer": null, "service": null, "route": null "config": {"hide_client_headers": false, "minute": 5, "policy": "local", "month": null, "redis_timeout": 2000, "limit_by": "consumer", "redis_password": null, "second": null, "day": null, "redis_database": 0, "year": null, "hour": null, "redis_host": null, "redis_port": 6379, "header_name": null, "fault_tolerant": true}}

6 requests in a row

Curl-I-X GET http://localhost:8000/mock/requestHTTP/1.1 429 Too Many RequestsDate: Fri, 31 Jul 2020 08:24:37 GMTContent-Type: application/json Charset=utf-8Connection: keep-aliveRetry-After: 23Content-Length: 41X-RateLimit-Remaining-Minute: 0X-RateLimit-Limit-Minute: 5RateLimit-Remaining: 0RateLimit-Limit: 5RateLimit-Reset: 23X-Kong-Response-Latency: kong/2.1.0 {"message": "API rate limit exceeded"} this is the end of the study on "how to set up kong plug-in rate-limiting", hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Plug-ins learning more help practical next global memory data articles methods times theory knowledge articles websites materials follow questions easy to use Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Tech Info vpn NVidia Shulou Information