CORS
Deprecated (with error)
This plugin was moved to io.ktor.server.plugins.cors.routing
Replace with
import io.ktor.server.plugins.cors.routing.CORS
Content copied to clipboard
CORS
Content copied to clipboard
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)
}
Content copied to clipboard
You can learn more from CORS.