fix(api): test ip
This commit is contained in:
@@ -45,5 +45,12 @@ namespace PARR.API.Controllers.V1
|
|||||||
|
|
||||||
return Ok(new Response<ApiHealthResponse>(response, true));
|
return Ok(new Response<ApiHealthResponse>(response, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("/get-ip")]
|
||||||
|
public IActionResult Test()
|
||||||
|
{
|
||||||
|
var ip = HttpContext.Connection.RemoteIpAddress?.MapToIPv4();
|
||||||
|
return Ok(ip.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,19 +34,19 @@ builder.Configuration.AddDalConfigurations(builder.Services);
|
|||||||
builder.Services.AddDallSettings(builder.Configuration);
|
builder.Services.AddDallSettings(builder.Configuration);
|
||||||
|
|
||||||
// Auth
|
// Auth
|
||||||
builder.Services.AddAuthentication(ParrAuthenticationOptions.DefaultScheme)
|
//builder.Services.AddAuthentication(ParrAuthenticationOptions.DefaultScheme)
|
||||||
.AddScheme<ParrAuthenticationOptions, ParrAuthenticationHandler>(ParrAuthenticationOptions.DefaultScheme, opt => { });
|
// .AddScheme<ParrAuthenticationOptions, ParrAuthenticationHandler>(ParrAuthenticationOptions.DefaultScheme, opt => { });
|
||||||
// не используем, так как проверка ролей остается прежней, а роли подставляем в ParrAuthenticationHandler
|
// не используем, так как проверка ролей остается прежней, а роли подставляем в ParrAuthenticationHandler
|
||||||
//builder.Services.AddSimpleRoleAuthorization<BaseSimpleRoleProvider>();
|
//builder.Services.AddSimpleRoleAuthorization<BaseSimpleRoleProvider>();
|
||||||
|
|
||||||
// При использовании балансировщика (haproxy, перенаправлять заголовки)
|
// При использовании балансировщика (haproxy, перенаправлять заголовки)
|
||||||
builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
//builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
{
|
//{
|
||||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
// options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||||
|
|
||||||
options.KnownNetworks.Clear();
|
// options.KnownNetworks.Clear();
|
||||||
options.KnownProxies.Clear();
|
// options.KnownProxies.Clear();
|
||||||
});
|
//});
|
||||||
|
|
||||||
|
|
||||||
builder.Services.AddHttpContextAccessor();
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
|||||||
Reference in New Issue
Block a user