HttpsRedirect

val HttpsRedirect: <ERROR CLASS><HttpsRedirectConfig>

A plugin that redirects all HTTP requests to the HTTPS counterpart before processing the call.

The code snippet below shows how to configure the desired HTTPS port and return 301 Moved Permanently for the requested resource:

install(HttpsRedirect) {
sslPort = 8443
permanentRedirect = true
}

You can learn more from HttpsRedirect.