From e40afb2c3d984d1ff7b1d1e2ae35aa6602dec535 Mon Sep 17 00:00:00 2001 From: jay-tux Date: Thu, 27 Aug 2026 14:10:04 +0200 Subject: [PATCH] Server: CORS support on SSE routes --- server/src/main/kotlin/com/jaytux/phoebench/server/Main.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/main/kotlin/com/jaytux/phoebench/server/Main.kt b/server/src/main/kotlin/com/jaytux/phoebench/server/Main.kt index 04ea570..352f585 100644 --- a/server/src/main/kotlin/com/jaytux/phoebench/server/Main.kt +++ b/server/src/main/kotlin/com/jaytux/phoebench/server/Main.kt @@ -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."))