From e053f7fb816c0c383b4a3d3aecf079f8a19414bb Mon Sep 17 00:00:00 2001 From: Ziedelth Date: Wed, 22 May 2024 16:05:01 +0200 Subject: [PATCH] Fix IP log --- src/main/kotlin/fr/shikkanime/modules/Routing.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/fr/shikkanime/modules/Routing.kt b/src/main/kotlin/fr/shikkanime/modules/Routing.kt index fcdfbf86..c2175aeb 100644 --- a/src/main/kotlin/fr/shikkanime/modules/Routing.kt +++ b/src/main/kotlin/fr/shikkanime/modules/Routing.kt @@ -99,7 +99,7 @@ private fun logCallDetails(call: ApplicationCall) { val status = call.response.status()?.value ?: 0 val duration = ZonedDateTime.now().toInstant().toEpochMilli() - startTime.toInstant().toEpochMilli() val path = call.request.path() - val ipAddress = call.request.origin.remoteHost + val ipAddress = call.request.header("X-Forwarded-For") ?: call.request.origin.remoteHost val userAgent = call.request.userAgent() ?: "Unknown" logger.info("[$ipAddress - $userAgent] ($status - $duration ms) $httpMethod ${call.request.origin.uri} -> $path")