1
0

ratelimitconfig.json 920 B

123456789101112131415161718192021222324252627282930313233
  1. {
  2. /*
  3. https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/IpRateLimitMiddleware
  4. https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Using-Redis-as-a-distributed-counter-store
  5. */
  6. "IpRateLimiting": {
  7. "EnableEndpointRateLimiting": true,
  8. "StackBlockedRequests": false,
  9. "RealIpHeader": "X-Real-IP",
  10. "ClientIdHeader": "X-ClientId",
  11. "IpWhitelist": [], // "127.0.0.1"
  12. "EndpointWhitelist": [ "get:/api/admin/auth/refresh" ], // "get:/api/a", "*:/api/b"
  13. "ClientWhitelist": [],
  14. "HttpStatusCode": 429,
  15. "QuotaExceededResponse": {
  16. "Content": "{{\"code\":429,\"msg\":\"访问过于频繁!\"}}",
  17. "ContentType": "application/json",
  18. "StatusCode": 429
  19. },
  20. "GeneralRules": [
  21. {
  22. "Endpoint": "*",
  23. "Period": "1s",
  24. "Limit": 3
  25. },
  26. {
  27. "Endpoint": "*",
  28. "Period": "10m",
  29. "Limit": 200
  30. }
  31. ]
  32. }
  33. }