diff --git a/AsbCloudWebApi/Middlewares/RequerstTrackerMiddleware.cs b/AsbCloudWebApi/Middlewares/RequerstTrackerMiddleware.cs index e8910b5d..392b3bca 100644 --- a/AsbCloudWebApi/Middlewares/RequerstTrackerMiddleware.cs +++ b/AsbCloudWebApi/Middlewares/RequerstTrackerMiddleware.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; -using Org.BouncyCastle.Asn1.Ocsp; +using System.Linq; using System.Threading.Tasks; namespace AsbCloudWebApi.Middlewares @@ -18,10 +18,11 @@ namespace AsbCloudWebApi.Middlewares public async Task InvokeAsync(HttpContext context) { var service = context.RequestServices.GetRequiredService(); + var clientIp = context.Request.Headers["X-Real-IP"].FirstOrDefault(); var requestLog = new AsbCloudApp.Data.RequestLogDto { UserLogin = context.User.Identity?.Name ?? string.Empty, - UserIp = context.Connection?.RemoteIpAddress?.ToString(), + UserIp = clientIp ?? context.Connection?.RemoteIpAddress?.ToString(), RequestMethod = context.Request.Method, RequestPath = context.Request.Path.Value, RequestContentLength = context.Request.ContentLength, diff --git a/AsbCloudWebApi/Startup.cs b/AsbCloudWebApi/Startup.cs index f04a53d1..dd49dfad 100644 --- a/AsbCloudWebApi/Startup.cs +++ b/AsbCloudWebApi/Startup.cs @@ -158,11 +158,6 @@ namespace AsbCloudWebApi endpoints.MapHub("/hubs/telemetry"); endpoints.MapHub("/hubs/reports"); }); - - app.UseSpa(spa => - { - spa.Options.SourcePath = "wwwroot"; - }); } } }