This commit is contained in:
2026-05-31 05:52:44 +02:00

View File

@@ -326,9 +326,19 @@ try
app.UseAuthentication();
app.UseAuthorization();
app.MapReverseProxy();
app.MapControllers();
// Catch-all YARP proxy — only forward requests that are not swagger/scalar/openapi paths.
app.MapWhen(
ctx =>
{
var path = ctx.Request.Path.Value ?? string.Empty;
return !path.StartsWith("/swagger", StringComparison.OrdinalIgnoreCase) &&
!path.StartsWith("/scalar", StringComparison.OrdinalIgnoreCase) &&
!path.StartsWith("/openapi", StringComparison.OrdinalIgnoreCase);
},
branch => branch.UseRouting().UseEndpoints(e => e.MapReverseProxy()));
app.Run();
}
catch (Exception ex)