From d8f4094d52bb5bfbb31890b80c6ab87f0d2642c8 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Tue, 7 Nov 2023 14:02:04 +0500 Subject: [PATCH] =?UTF-8?q?1.=20=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=B4=D0=B8=D1=80=D0=B5=D0=BA=D1=82=D0=B8=D0=B2=D0=B0=20Use?= =?UTF-8?q?Spa=20=D0=B8=D0=B7=20ConfigureServices=202.=20=D0=A1=D1=87?= =?UTF-8?q?=D0=B8=D1=82=D1=8B=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20ip=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B8=D0=B7=20=D0=B7=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20"X-Real-IP"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudWebApi/Middlewares/RequerstTrackerMiddleware.cs | 5 +++-- AsbCloudWebApi/Startup.cs | 5 ----- 2 files changed, 3 insertions(+), 7 deletions(-) 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"; - }); } } }