From 218a82998a5ea28fba8030deb529965b593cca54 Mon Sep 17 00:00:00 2001 From: Robin Dadswell <19610103+RobinDadswell@users.noreply.github.com> Date: Thu, 3 Jun 2021 10:50:13 +0100 Subject: [PATCH] Fixed: Real IP logging when IPv4 is mapped as IPv6 --- src/Readarr.Http/Extensions/RequestExtensions.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Readarr.Http/Extensions/RequestExtensions.cs b/src/Readarr.Http/Extensions/RequestExtensions.cs index 5e01258ea..1928a428a 100644 --- a/src/Readarr.Http/Extensions/RequestExtensions.cs +++ b/src/Readarr.Http/Extensions/RequestExtensions.cs @@ -156,6 +156,12 @@ namespace Readarr.Http.Extensions } var remoteIP = request.HttpContext.Connection.RemoteIpAddress; + + if (remoteIP.IsIPv4MappedToIPv6) + { + remoteIP = remoteIP.MapToIPv4(); + } + var remoteAddress = remoteIP.ToString(); // Only check if forwarded by a local network reverse proxy