Configuration: traffic control

This page covers KDL traffic-control directives used to rate-limit requests globally or within specific locations.

Directives

Rate limiting

  • limit [enable_limit: bool] [rate=<rate: integer|float>] [burst=<rate: integer|float>] (limit module)
    • This directive specifies whether the rate limiting is enabled. The rate prop specifies the maximum average amount of requests per second, defaults to 25 requests per second. The burst prop specifies the maximum peak amount of requests per second, defaults to 4 times the maximum average amount of requests per second. Default: limit #false

Configuration example:

example.com {
    // Global rate limiting
    limit rate=100 burst=200

    // Different rate limits for different paths
    location "/api" {
        limit rate=10 burst=20
    }

    location "/login" {
        limit rate=5 burst=10
    }
}