新增CORS

This commit is contained in:
Raymond Yang 2023-06-26 20:42:35 +08:00
parent 24f7726727
commit 21eac9a417

View File

@ -11,7 +11,9 @@ fun Application.configureHTTP() {
allowMethod(HttpMethod.Delete)
allowMethod(HttpMethod.Patch)
allowHeader(HttpHeaders.Authorization)
allowHeader("MyCustomHeader")
anyHost() // @TODO: Don't do this in production if possible. Try to limit it.
allowHeader(HttpHeaders.AccessControlAllowOrigin)
anyHost()
allowCredentials = true
allowNonSimpleContentTypes = true
}
}