Random Stuff (#3798)

This commit is contained in:
Joe Milazzo 2025-05-10 15:57:14 -06:00 committed by GitHub
parent 574cf4b78e
commit 70f00895e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 659 additions and 567 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Text.Json;
using System.Threading.Tasks;
@ -26,7 +27,7 @@ public class SecurityEventMiddleware(RequestDelegate next)
}
catch (KavitaUnauthenticatedUserException ex)
{
var ipAddress = context.Connection.RemoteIpAddress?.ToString();
var ipAddress = context.Request.Headers["X-Forwarded-For"].FirstOrDefault() ?? context.Connection.RemoteIpAddress?.ToString();
var requestMethod = context.Request.Method;
var requestPath = context.Request.Path;
var userAgent = context.Request.Headers.UserAgent;