From 6d3d0420ddedc61401ec8cca70379c6def8aed2f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 3 Sep 2022 14:11:36 +0300 Subject: [PATCH] Add forward headers --- build.gradle.kts | 1 + src/main/kotlin/ru/mipt/spc/Application.kt | 3 +++ src/main/kotlin/ru/mipt/spc/spcMisc.kt | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7f3a351..daf561b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,6 +29,7 @@ dependencies { implementation("io.ktor:ktor-server-netty:$ktorVersion") implementation("io.ktor:ktor-server-http-redirect:$ktorVersion") + implementation("io.ktor:ktor-server-forwarded-header:$ktorVersion") implementation("ch.qos.logback:logback-classic:1.2.11") testImplementation("io.ktor:ktor-server-tests:$ktorVersion") diff --git a/src/main/kotlin/ru/mipt/spc/Application.kt b/src/main/kotlin/ru/mipt/spc/Application.kt index 8277062..5ecbba0 100644 --- a/src/main/kotlin/ru/mipt/spc/Application.kt +++ b/src/main/kotlin/ru/mipt/spc/Application.kt @@ -1,6 +1,8 @@ package ru.mipt.spc import io.ktor.server.application.Application +import io.ktor.server.application.install +import io.ktor.server.plugins.forwardedheaders.ForwardedHeaders import space.kscience.snark.SnarkEnvironment import space.kscience.snark.ktor.extractResources import space.kscience.snark.ktor.prepareSnarkDataCacheDirectory @@ -11,6 +13,7 @@ import kotlin.io.path.div @Suppress("unused") fun Application.spcModule() { // install(HttpsRedirect) + install(ForwardedHeaders) val dataPath = Path.of("data") diff --git a/src/main/kotlin/ru/mipt/spc/spcMisc.kt b/src/main/kotlin/ru/mipt/spc/spcMisc.kt index 36ca434..c9a2b3e 100644 --- a/src/main/kotlin/ru/mipt/spc/spcMisc.kt +++ b/src/main/kotlin/ru/mipt/spc/spcMisc.kt @@ -125,7 +125,7 @@ context(WebPage) internal fun FlowContent.spcFooter() { // } li { a(classes = "icon brands alt fa-github") { - href = "https://github.com/mipt-npm" + href = "https://github.com/SciProgCentre" span("label") { +"""GitHub""" } } }