From e92ffd376a53400987b73f61ad5dbab75672206c Mon Sep 17 00:00:00 2001 From: William Brawner Date: Sun, 21 Apr 2024 10:02:45 -0600 Subject: [PATCH] Add XForwardedHeaders plugin --- app/src/main/kotlin/com/wbrawner/twigs/server/Application.kt | 2 ++ gradle/libs.versions.toml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/src/main/kotlin/com/wbrawner/twigs/server/Application.kt b/app/src/main/kotlin/com/wbrawner/twigs/server/Application.kt index 0218647..a7a2f88 100644 --- a/app/src/main/kotlin/com/wbrawner/twigs/server/Application.kt +++ b/app/src/main/kotlin/com/wbrawner/twigs/server/Application.kt @@ -33,6 +33,7 @@ import io.ktor.server.mustache.* import io.ktor.server.plugins.callloging.* import io.ktor.server.plugins.contentnegotiation.* import io.ktor.server.plugins.cors.routing.* +import io.ktor.server.plugins.forwardedheaders.* import io.ktor.server.response.* import io.ktor.server.sessions.* import kotlinx.coroutines.* @@ -167,6 +168,7 @@ fun Application.moduleWithDependencies( jobs: List, sessionValidator: suspend ApplicationCall.(Session) -> Principal? ) { + install(XForwardedHeaders) install(CallLogging) install(Authentication) { session { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a32dba4..38f6935 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -29,6 +29,7 @@ ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" } ktor-server-content-negotiation = { module = "io.ktor:ktor-server-content-negotiation", version.ref = "ktor" } ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" } ktor-server-cors = { module = "io.ktor:ktor-server-cors", version.ref = "ktor" } +ktor-server-forwarded-headers = { module = "io.ktor:ktor-server-forwarded-header", version.ref = "ktor" } ktor-server-mustache = { module = "io.ktor:ktor-server-mustache", version.ref = "ktor" } ktor-server-sessions = { module = "io.ktor:ktor-server-sessions", version.ref = "ktor" } ktor-server-test = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" } @@ -44,6 +45,7 @@ ktor-server = [ "ktor-server-content-negotiation", "ktor-server-core", "ktor-server-cors", + "ktor-server-forwarded-headers", "ktor-server-sessions" ]