rateLimit

fun Route.rateLimit(configuration: RateLimitName = LIMITER_NAME_EMPTY, build: Route.() -> Unit): Route(source)

Creates a route with Rate-Limit rules applied to it. This function accepts name of RateLimit providers defined in the RateLimit plugin configuration.

When combined with other route-scoped guard plugins such as authentication, the relative execution order follows route nesting: interceptors on parent routes run before interceptors on child routes. To use a principal in RateLimitProviderConfig.requestKey, nest rateLimit inside io.ktor.server.auth.authenticate.

Report a problem

Parameters

configuration

names of RateLimit providers defined in the RateLimit plugin configuration.

See also

Throws

if there are no registered providers referred by configuration names.