CORS

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) {
host("0.0.0.0:8081")
header(HttpHeaders.ContentType)
}

You can learn more from CORS.