Ktor 1.5.4 Help


The AutoHeadResponse feature provides us with the ability to automatically respond to HEAD request for every route that has a GET defined.


In order to take advantage of this functionality, we need to install the AutoHeadResponse feature in our application

fun Application.main() { install(AutoHeadResponse) routing { get("/home") { call.respondText("This is a response to a GET, but HEAD also works") } } }

In our case the /home route will now respond to HEAD request even though there is no explicit definition for this verb.

It's important to note that if we're using this feature, custom HEAD definitions for the same GET route will be ignored.


AutoHeadResponse does not provide any additional configuration options.

Last modified: 19 April 2021