Estimated reading time: 1 minute

By default, Ktor HTTP client doesnā€™t follow redirections (except for Apache and configuring it), this feature allows to follow Location redirects in a way that works with any HTTP engine. Its usage is pretty straightforward and the only configurable property is the maxJumps (20 by default) that limits how many redirects are tried before giving up (to prevent infinite redirects).

This feature is defined in the class io.ktor.client.features.HttpRedirect and no additional artifacts are required.


val client = HttpClient(HttpClientEngine) {
    install(HttpRedirect) {
        maxJumps = 20

This feature is included in the core of the HttpClient so it is available always along the client.