|
@@ -24,6 +24,12 @@ namespace Hotline.Api.Filter
|
|
|
// context.HttpContext.Items["ClientIp"] = ip;
|
|
|
//}
|
|
|
var ip = context.HttpContext.Request.Headers["X-Forwarded-For"].FirstOrDefault();
|
|
|
+ if(string.IsNullOrEmpty(ip))
|
|
|
+ ip = context.HttpContext.Request.Headers["X-Real-IP"].FirstOrDefault();
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(ip))
|
|
|
+ ip = context.HttpContext.Connection.RemoteIpAddress?.ToString();
|
|
|
+
|
|
|
if (string.IsNullOrEmpty(ip))
|
|
|
{
|
|
|
_logger.LogWarning("Forbidden Request from IP: {RemoteIp}", ip);
|