It has been observed that Ocelot middleware flushes the response when a 404 error is raised. Hence any middleware applied to redirect to a custom 404 page does not work. A standard HTML page it seems generated by the Ocelot middleware is rendered on the browser.
Our team checked the HttpContext.response.HasStarted flag via a custom middleware. If Ocelot middleware is present it comes as true else is comes as false when error code 404 is raised.
Is there a workaround to make it work.