Add configurable path base for API routing
This commit is contained in:
parent
1545337143
commit
17279cb6e0
@ -128,8 +128,15 @@ builder.Services.AddHttpClient<SendEngineWebhookPublisher>();
|
|||||||
builder.Services.AddScoped<ISendEngineWebhookPublisher, SendEngineWebhookPublisher>();
|
builder.Services.AddScoped<ISendEngineWebhookPublisher, SendEngineWebhookPublisher>();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
var pathBase = builder.Configuration["PathBase"];
|
||||||
|
|
||||||
app.UseForwardedHeaders();
|
app.UseForwardedHeaders();
|
||||||
|
if (!string.IsNullOrWhiteSpace(pathBase))
|
||||||
|
{
|
||||||
|
var normalizedPathBase = pathBase.StartsWith('/') ? pathBase : $"/{pathBase}";
|
||||||
|
app.UsePathBase(normalizedPathBase);
|
||||||
|
}
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user