Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(conference-request): enable CORS headers #1180

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions jicofo/src/main/kotlin/org/jitsi/jicofo/ktor/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<ConferenceRequest>()
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@
<artifactId>spotbugs-annotations</artifactId>
<version>${spotbugs.version}</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-server-cors-jvm</artifactId>
<version>${ktor_version}</version>
</dependency>
<!-- runtime -->
<dependency>
<groupId>rusv</groupId>
Expand Down
Loading