Server: CORS support on SSE routes
This commit is contained in:
@@ -37,9 +37,6 @@ fun Application.module() {
|
||||
json()
|
||||
}
|
||||
|
||||
|
||||
install(SSE) {}
|
||||
|
||||
val allowLocalhost = environment.config.propertyOrNull("ktor.cors.enableLocalhostOn")?.getString() ?: "0"
|
||||
val safeOrigin = environment.config.propertyOrNull("ktor.cors.browserOrigin")?.getString()
|
||||
install(CORS) {
|
||||
@@ -73,6 +70,8 @@ fun Application.module() {
|
||||
}
|
||||
}
|
||||
|
||||
install(SSE) {}
|
||||
|
||||
install(StatusPages) {
|
||||
status(HttpStatusCode.Forbidden) { call, status ->
|
||||
call.respond(status, ErrorResponse("Access Forbidden: CORS failed."))
|
||||
|
||||
Reference in New Issue
Block a user