save checkpoint
This commit is contained in:
@@ -9,6 +9,7 @@ using StellaOps.Configuration;
|
||||
using StellaOps.Gateway.WebService.Authorization;
|
||||
using StellaOps.Gateway.WebService.Configuration;
|
||||
using StellaOps.Gateway.WebService.Middleware;
|
||||
using StellaOps.Gateway.WebService.Routing;
|
||||
using StellaOps.Gateway.WebService.Security;
|
||||
using StellaOps.Gateway.WebService.Services;
|
||||
using StellaOps.Messaging.DependencyInjection;
|
||||
@@ -126,6 +127,19 @@ builder.Services.AddSingleton(new IdentityHeaderPolicyOptions
|
||||
AllowScopeHeaderOverride = bootstrapOptions.Auth.AllowScopeHeader
|
||||
});
|
||||
|
||||
// Route table: resolver + error routes + HTTP client for reverse proxy
|
||||
builder.Services.AddSingleton(new StellaOpsRouteResolver(bootstrapOptions.Routes));
|
||||
builder.Services.AddSingleton<IEnumerable<StellaOpsRoute>>(
|
||||
bootstrapOptions.Routes.Where(r =>
|
||||
r.Type == StellaOpsRouteType.NotFoundPage ||
|
||||
r.Type == StellaOpsRouteType.ServerErrorPage).ToList());
|
||||
builder.Services.AddHttpClient("RouteDispatch")
|
||||
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
|
||||
{
|
||||
ServerCertificateCustomValidationCallback =
|
||||
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
|
||||
});
|
||||
|
||||
ConfigureAuthentication(builder, bootstrapOptions);
|
||||
ConfigureGatewayOptionsMapping(builder, bootstrapOptions);
|
||||
|
||||
@@ -152,6 +166,12 @@ app.UseMiddleware<IdentityHeaderPolicyMiddleware>();
|
||||
app.UseMiddleware<HealthCheckMiddleware>();
|
||||
app.TryUseStellaRouter(routerOptions);
|
||||
|
||||
// WebSocket support (before route dispatch)
|
||||
app.UseWebSockets();
|
||||
|
||||
// Route dispatch for configured routes (static files, reverse proxy, websocket)
|
||||
app.UseMiddleware<RouteDispatchMiddleware>();
|
||||
|
||||
if (bootstrapOptions.OpenApi.Enabled)
|
||||
{
|
||||
app.MapRouterOpenApi();
|
||||
@@ -171,6 +191,9 @@ app.UseWhen(
|
||||
branch.UseMiddleware<RequestRoutingMiddleware>();
|
||||
});
|
||||
|
||||
// Error page fallback (after all other middleware)
|
||||
app.UseMiddleware<ErrorPageFallbackMiddleware>();
|
||||
|
||||
// Refresh Router endpoint cache
|
||||
app.TryRefreshStellaRouterEndpoints(routerOptions);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user