CORS

val CORS: <ERROR CLASS><CORSConfig>

A plugin that allows you to configure handling cross-origin requests. This plugin allows you to configure allowed hosts, HTTP methods, headers set by the client, and so on.

The configuration below allows requests from the specified address and allows sending the Content-Type header:

install(CORS) {
allowHost("0.0.0.0:8081")
allowHeader(HttpHeaders.ContentType)
}

You can learn more from CORS.