Redirect
By default, the Ktor client redirects to URLs provided in the Location
header. If required, you can disable redirections.
Add dependencies
HttpRedirect
only requires the ktor-client-core artifact and doesn't need any specific dependencies.
Disable redirects
To disable redirections, set the followRedirects
property to false
in a client configuration block:
val client = HttpClient(CIO) {
followRedirects = false
}
Last modified: 02 April 2024