test 测试获取远程ip
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Kurisu.AspNetCore.Cache.Extensions;
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
|
||||
class Program
|
||||
@@ -21,6 +22,14 @@ public class Startup : DefaultStartup
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders = ForwardedHeaders.All;
|
||||
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
});
|
||||
|
||||
base.ConfigureServices(services);
|
||||
services.AddRedis();
|
||||
|
||||
@@ -37,4 +46,10 @@ public class Startup : DefaultStartup
|
||||
return handler;
|
||||
});
|
||||
}
|
||||
|
||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
app.UseForwardedHeaders();
|
||||
base.Configure(app, env);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user