Skip to content

Commit

Permalink
Remove IP API response (#4771)
Browse files Browse the repository at this point in the history
  • Loading branch information
withinfocus committed Sep 12, 2024
1 parent aa36134 commit 95ba256
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/Api/Controllers/InfoController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,4 @@ public JsonResult GetVersion()
{
return Json(AssemblyHelpers.GetVersion());
}

[HttpGet("~/ip")]
public JsonResult Ip()
{
var headerSet = new HashSet<string> { "x-forwarded-for", "x-connecting-ip", "cf-connecting-ip", "client-ip", "true-client-ip" };
var headers = HttpContext.Request?.Headers
.Where(h => headerSet.Contains(h.Key.ToLower()))
.ToDictionary(h => h.Key);
return new JsonResult(new
{
Ip = HttpContext.Connection?.RemoteIpAddress?.ToString(),
Headers = headers,
});
}
}

0 comments on commit 95ba256

Please sign in to comment.