- List of NuGet packages and version that you are using:
- Runtime version (e.g. net461, net48, netcoreapp2.1, netcoreapp3.1, etc. You can find this information from the
*.csproj file):
- Hosting environment (e.g. Azure Web App, App Service on Linux, Windows, Ubuntu, etc.):
Describe the bug
A clear and concise description of what the bug is.
X-Forwarded-For is specified with an IPv6 IP address and we return just the first 4 characters.
X-Forwarded-For : 180.60.62.8:36608 becomes 180.60.62.8
X-Forwarded-For : 2400:4151:f82:3000:8d8:f068:5c34:824, 147.243.22.167:52155 becomes 2400
There is an inconsistency between the ASP NET and .NET Core implementations:
- Core
|
private string GetIpFromHeader(string clientIpsFromHeader) |
- AspNet
|
private static string CutPort(string address) |
One uses LastIndexOf and other other uses IndexOf to find the : character.
*.csprojfile):Describe the bug
A clear and concise description of what the bug is.
X-Forwarded-Foris specified with an IPv6 IP address and we return just the first 4 characters.X-Forwarded-For : 180.60.62.8:36608becomes180.60.62.8X-Forwarded-For : 2400:4151:f82:3000:8d8:f068:5c34:824, 147.243.22.167:52155becomes2400There is an inconsistency between the ASP NET and .NET Core implementations:
ApplicationInsights-dotnet/NETCORE/src/Microsoft.ApplicationInsights.AspNetCore/TelemetryInitializers/ClientIpHeaderTelemetryInitializer.cs
Line 159 in 3b15e65
ApplicationInsights-dotnet/WEB/Src/Web/Web/ClientIpHeaderTelemetryInitializer.cs
Line 106 in 3b15e65
One uses LastIndexOf and other other uses IndexOf to find the
:character.