Presence of SEO Checker cancels middleware execution
If you have a simple piece of custom middleware installed on the same website as SEO Checker, the presence of SEO Checker will cancel the execution of that middleware.
If you add a custom piece of middleware like this, to the app.UseUmbraco().WithMiddleware(...) part of Startup.cs, the middleware will not be executed when visiting a frontend page of the website. It will however be executed when visiting the backoffice.
class TrackingContentMiddleware
{
private readonly RequestDelegate _next;
public TrackingContentMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task InvokeAsync(HttpContext context)
{
IUmbracoContextFactory umbracoContextFactory = context.RequestServices.GetRequiredService<IUmbracoContextFactory>();
using (UmbracoContextReference umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext())
{
IPublishedContent? content = umbracoContextReference.UmbracoContext?.PublishedRequest?.PublishedContent;
//Add tracking stuff here
}
await _next.Invoke(context);
}
}
If you then go ahead and remove SEO Checker from the website, the middleware will be executed on every frontend page visit.
Turning on/off rewrites and/or redirects in SEO Checker does not make a difference.
Moving the middleware outside of the app.UseUmbraco().WithMiddleware(...) will make it execute, but that is not where it's supposed to be, and won't make the middleware work as expected.
Note: The middleware in this post is an example.
Solution is running: Umbraco CMS 10.4.2 and SEO Checker 10.0.4.
Presence of SEO Checker cancels middleware execution
If you have a simple piece of custom middleware installed on the same website as SEO Checker, the presence of SEO Checker will cancel the execution of that middleware.
If you add a custom piece of middleware like this, to the
app.UseUmbraco().WithMiddleware(...)
part ofStartup.cs
, the middleware will not be executed when visiting a frontend page of the website. It will however be executed when visiting the backoffice.If you then go ahead and remove SEO Checker from the website, the middleware will be executed on every frontend page visit.
Turning on/off rewrites and/or redirects in SEO Checker does not make a difference.
Moving the middleware outside of the
app.UseUmbraco().WithMiddleware(...)
will make it execute, but that is not where it's supposed to be, and won't make the middleware work as expected.Note: The middleware in this post is an example.
Solution is running: Umbraco CMS 10.4.2 and SEO Checker 10.0.4.
This seems like a bug in the Umbraco 10 version of SEO Checker.
I did the same test on a site running Umbraco 12.1.1 and SEO Checker 12.0.0 and the middleware is acting as expected.
is working on a reply...