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