From 2c865259849f5db8d77eae9774dda3c2d8858bdc Mon Sep 17 00:00:00 2001 From: yostane <1958676+yostane@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:13:53 +0200 Subject: [PATCH] Add cors config --- .../src/main/kotlin/example/com/plugins/HTTP.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/material/rest-api-ui-ktor-quiz-collector/src/main/kotlin/example/com/plugins/HTTP.kt b/material/rest-api-ui-ktor-quiz-collector/src/main/kotlin/example/com/plugins/HTTP.kt index feb2bdcd..e7756229 100644 --- a/material/rest-api-ui-ktor-quiz-collector/src/main/kotlin/example/com/plugins/HTTP.kt +++ b/material/rest-api-ui-ktor-quiz-collector/src/main/kotlin/example/com/plugins/HTTP.kt @@ -17,6 +17,8 @@ fun Application.configureHTTP() { } install(CORS) { allowMethod(HttpMethod.Options) - anyHost() // @TODO: Don't do this in production if possible. Try to limit it. + allowHeader(HttpHeaders.ContentType) + allowHost("verbal-paula-yostane-5911cad1.koyeb.app", schemes = listOf("https")) + allowHost("localhost:9091") } }