Skip to content

Commit ae8cbe7

Browse files
committed
feat(backend): Enabled HSTS
1 parent 00aee81 commit ae8cbe7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

backend/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies {
1212
implementation(Ktor.server.netty)
1313
implementation(Ktor.server.callLogging)
1414
implementation(Ktor.server.auth)
15+
implementation(Ktor.server.hsts)
1516
implementation(Ktor.plugins.serialization)
1617

1718
implementation(KotlinX.serialization.core)

backend/src/main/kotlin/Backend.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import io.ktor.server.auth.*
55
import io.ktor.server.engine.*
66
import io.ktor.server.netty.*
77
import io.ktor.server.plugins.callloging.*
8+
import io.ktor.server.plugins.hsts.*
89
import io.ktor.server.response.*
910
import io.ktor.server.routing.*
1011
import opensavvy.backbone.Ref.Companion.now
@@ -51,7 +52,11 @@ fun Application.formulaide() {
5152
}
5253
}
5354

54-
if (developmentMode) {
55+
if (!developmentMode) {
56+
install(HSTS) {
57+
includeSubDomains = true
58+
}
59+
} else {
5560
log.error("DEVELOPMENT MODE IS ENABLED. THIS IS NOT SAFE FOR PRODUCTION.")
5661
}
5762

0 commit comments

Comments
 (0)