UmbracoRequestMiddleware ran on generic controllers

As you can see in the screenshot below the Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddlewareis trigerring on all Controller actions that we might have implemented on our website, this adds unnecessary overhead to high-frequency actions that we have causing significant performance issues.

In this particular case you can see that even though our cached endpoint data was processed in ~300ms it then took another full 5 seconds for the response to close due to this middleware for which there seems to be no way of disabling.

Is there anything we can do to not have it run on our own controllers?

Hi,

This sounds like a job for reserved routes / URLs in app settings

Hope this helps
Matt

I’ve tried that and it doesn’t seem to work at all this is my setup “ReservedUrls”: “~/.well-known,~/api/content,” and the middleware is still trigerring, it doesn’t change if I use the Routes either.

I see that there is a method that checks IsClientSideRequest() but I would need to explicitly add extensions to the endpoint calls, so it only works for files essentially.

Is there anything else we can try?

ReservedUrls is for individual URLs, you need to use ReservedPaths.

Try this:

"ReservedPaths": "~/app_plugins/,~/install/,~/mini-profiler-resources/,~/umbraco/,~/api/content/",