asp.net
core The program is deployed in centos7( The following solution , Other systems can be used , It's just my own deployment centos7), Use server jexus Deploy ,AppHost pattern .

Because the request was made by jexus Forwarded , therefore asp.net zero Acquired ip Always 127.0.0.1..

Solution :

Using the Jexus Provided by the author's cloud JwsIntegration replace IISIntegration, It changes the default to get from the request header ip Rules of , Change to
“X-Original-For” Get remote ip( Tested use "X-Real-IP" It can also be obtained ).

JwsIntegration.cs:
/// <summary> /// For handling customers IP address , Of port HostBuilder middleware /// </summary> public static
class WebHostBuilderJexusExtensions { /// <summary> /// Enable JexusIntegration middleware
/// </summary> /// <param name="hostBuilder"></param> /// <returns></returns>
public static IWebHostBuilder UseJexusIntegration(this IWebHostBuilder
hostBuilder) { if (hostBuilder == null) { throw new
ArgumentNullException(nameof(hostBuilder)); } // Check if it has been loaded if
(hostBuilder.GetSetting(nameof(UseJexusIntegration)) != null) { return
hostBuilder; } // Set loaded Tags , Prevent duplicate loading
hostBuilder.UseSetting(nameof(UseJexusIntegration), true.ToString()); //
add to configure handle hostBuilder.ConfigureServices(services => {
services.AddSingleton<IStartupFilter>(new JwsSetupFilter()); }); return
hostBuilder; } } class JwsSetupFilter : IStartupFilter { public
Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next) {
return app => { app.UseMiddleware<JexusMiddleware>(); next(app); }; } } class
JexusMiddleware { readonly RequestDelegate _next; public
JexusMiddleware(RequestDelegate next, ILoggerFactory loggerFactory,
IOptions<IISOptions> options) { _next = next; } public async Task
Invoke(HttpContext httpContext) { var headers = httpContext.Request.Headers;
try { if (headers != null && headers.ContainsKey("X-Original-For")) { var
ipaddAdndPort = headers["X-Original-For"].ToArray()[0]; var dot =
ipaddAdndPort.IndexOf(":", StringComparison.Ordinal); var ip = ipaddAdndPort;
var port = 0; if (dot > 0) { ip = ipaddAdndPort.Substring(0, dot); port =
int.Parse(ipaddAdndPort.Substring(dot + 1)); }
httpContext.Connection.RemoteIpAddress = System.Net.IPAddress.Parse(ip); if
(port != 0) httpContext.Connection.RemotePort = port; } } finally { await
_next(httpContext); } } }
usage method :