Add configurable path base for API routing

This commit is contained in:
Warren Chen 2026-03-26 04:06:36 +09:00
parent 1545337143
commit 17279cb6e0

View File

@ -128,8 +128,15 @@ builder.Services.AddHttpClient<SendEngineWebhookPublisher>();
builder.Services.AddScoped<ISendEngineWebhookPublisher, SendEngineWebhookPublisher>();
var app = builder.Build();
var pathBase = builder.Configuration["PathBase"];
app.UseForwardedHeaders();
if (!string.IsNullOrWhiteSpace(pathBase))
{
var normalizedPathBase = pathBase.StartsWith('/') ? pathBase : $"/{pathBase}";
app.UsePathBase(normalizedPathBase);
}
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();