客户端ip输出
This commit is contained in:
parent
9dc2ab2d6c
commit
8ecfdf4577
@ -2,6 +2,7 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FastGithub.ReverseProxy
|
||||
@ -46,6 +47,12 @@ namespace FastGithub.ReverseProxy
|
||||
var response = context.Response;
|
||||
var message = $"{request.Method} {request.Scheme}://{request.Host}{request.Path} responded {response.StatusCode} in {stopwatch.Elapsed.TotalMilliseconds} ms";
|
||||
|
||||
var client = context.Connection.RemoteIpAddress;
|
||||
if (IPAddress.Loopback.Equals(client) == false)
|
||||
{
|
||||
message = $"{client} {message}";
|
||||
}
|
||||
|
||||
var exception = context.GetForwarderErrorFeature()?.Exception;
|
||||
if (exception == null)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user