From 369d5491e8dc971160d97f1fa27a110b07ccb6e8 Mon Sep 17 00:00:00 2001 From: dalbodeule <11470513+dalbodeule@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:26:33 +0900 Subject: [PATCH] add Session flows (5x) - fix CORS --- .../space/mori/chzzk_bot/webserver/Main.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt index 156a84c..7cf4d14 100644 --- a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt +++ b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt @@ -46,15 +46,6 @@ val server = embeddedServer(Netty, port = 8080, ) { isLenient = true }) } - install(CORS) { - allowMethod(HttpMethod.Options) - allowMethod(HttpMethod.Put) - allowMethod(HttpMethod.Patch) - allowMethod(HttpMethod.Delete) - allowMethod(HttpMethod.Get) - allowHost(dotenv["FRONTEND"] ?: "localhost:3000", schemes = listOf("http", "https", "ws", "wss")) - allowCredentials = true - } install(Sessions) { cookie("user_session", storage = SessionStorageMemory()) {} } @@ -126,6 +117,16 @@ val server = embeddedServer(Netty, port = 8080, ) { } } } + + install(CORS) { + allowMethod(HttpMethod.Options) + allowMethod(HttpMethod.Put) + allowMethod(HttpMethod.Patch) + allowMethod(HttpMethod.Delete) + allowMethod(HttpMethod.Get) + allowHost(dotenv["FRONTEND"] ?: "localhost:3000", schemes=listOf("https")) + allowCredentials = true + } } fun start() {