Skip to content

Commit

Permalink
fix: Configure CORS properly to allow authorization and content-type …
Browse files Browse the repository at this point in the history
…header
  • Loading branch information
oSumAtrIX committed Sep 29, 2024
1 parent 710416f commit 6442757
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/kotlin/app/revanced/api/configuration/HTTP.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app.revanced.api.configuration

import app.revanced.api.configuration.repository.ConfigurationRepository
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.plugins.*
import io.ktor.server.plugins.cors.routing.*
Expand All @@ -13,6 +14,11 @@ fun Application.configureHTTP() {
val configurationRepository = get<ConfigurationRepository>()

install(CORS) {
allowHeader(HttpHeaders.ContentType)
allowHeader(HttpHeaders.Authorization)

allowCredentials = true

configurationRepository.corsAllowedHosts.forEach { host ->
allowHost(
host = host,
Expand Down

0 comments on commit 6442757

Please sign in to comment.