diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/ktor/Application.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/ktor/Application.kt index 9537366dc6..99b7ba60b3 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/ktor/Application.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/ktor/Application.kt @@ -27,6 +27,7 @@ import io.ktor.server.engine.embeddedServer import io.ktor.server.netty.Netty import io.ktor.server.netty.NettyApplicationEngine import io.ktor.server.plugins.contentnegotiation.ContentNegotiation +import io.ktor.server.plugins.cors.routing.CORS import io.ktor.server.plugins.statuspages.StatusPages import io.ktor.server.request.receive import io.ktor.server.response.respond @@ -144,6 +145,17 @@ class Application( private fun Route.conferenceRequest() { if (config.enableConferenceRequest) { + install(CORS) { + allowMethod(HttpMethod.Options) + allowMethod(HttpMethod.Post) + allowHeader(HttpHeaders.Authorization) + allowCredentials = true + allowNonSimpleContentTypes = true + allowSameOrigin = true + allowHost(ApplicationRequest.host(), schemes = listOf("https")) + } + + options("/conference-request/v1") {} post("/conference-request/v1") { val request = try { call.receive() diff --git a/pom.xml b/pom.xml index 2443a04d1d..d5a728b5dc 100644 --- a/pom.xml +++ b/pom.xml @@ -192,6 +192,11 @@ spotbugs-annotations ${spotbugs.version} + + io.ktor + ktor-server-cors-jvm + ${ktor_version} + rusv