Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
YARP - Startup with custom configuration provider
public class Startup
{
private readonly IConfiguration _configuration;
public Startup(IConfiguration configuration)
{
_configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
services
.AddSingleton<IProxyConfigProvider>(new CustomProxyConfigProvider())
.AddReverseProxy();
//.LoadFromConfig(_configuration.GetSection("ReverseProxy"));
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapReverseProxy();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment