Open luispfgarces opened 1 year ago
Proposed solution:
next
middleware to InvokeAsync
.StaticFileMiddleware
configuration.private async Task<bool> ExecuteHandlersAsync(HttpContext httpContext)
{
var results = this.httpRequestHandlers.Select(d => d
.HandleAsync(httpContext.Request, httpContext.Response, this.next));
var handle = await Task.WhenAll(results).ConfigureAwait(false);
return handle.All(d => !d);
}
public async Task InvokeAsync(HttpContext httpContext)
{
var anyHandlerExecuted = await this.ExecuteHandlersAsync(httpContext).ConfigureAwait(false);
if (!anyHandlerExecuted)
{
await this.next(httpContext).ConfigureAwait(false);
if (!httpContext.Response.HasStarted)
{
await this.ExecuteStaticFileMiddlewareAsync(httpContext).ConfigureAwait(true);
}
}
}
We can change the StaticFileMiddleware
configuration like this:
var staticFileOptions = new StaticFileOptions
{
RequestPath = string.IsNullOrEmpty(options.RoutePrefix) ? "/rules-static" : $"/{options.RoutePrefix}/rules-static",
FileProvider = provider,
ServeUnknownFileTypes = true
};
But we have to check other files in the Web UI that are using static files and include the /rules-static
resource segment.
Prerequisites
Description
When performing an HTTP request to another middleware (in this case, it happened requesting to a resource owned by the KafkaFlow middleware), the Rules.Framework Web UI tries to handle it and fails with an exception.
Steps to reproduce
Expected behavior
The Web UI should not try to handle resources that are not its' responsibility.
Actual behavior
When trying to access another resource that does not belong to Rules.Framework Web UI (from KafkaFlow UI in this case), an exception is thrown:
Rules Framework version
2.0.2