forked from ddrilling/AsbCloudServer
1. Удалена директива UseSpa из ConfigureServices
2. Считывание ip пользователя из заголовка "X-Real-IP"
This commit is contained in:
parent
b90dcf8483
commit
d8f4094d52
@ -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<AsbCloudApp.Services.IRequerstTrackerService>();
|
||||
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,
|
||||
|
@ -158,11 +158,6 @@ namespace AsbCloudWebApi
|
||||
endpoints.MapHub<TelemetryHub>("/hubs/telemetry");
|
||||
endpoints.MapHub<ReportsHub>("/hubs/reports");
|
||||
});
|
||||
|
||||
app.UseSpa(spa =>
|
||||
{
|
||||
spa.Options.SourcePath = "wwwroot";
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user