Custom Route Matcher doesn't get called

I have a route that uses a custom matcher

[Route("/users/{id}", Matches = "ReturnFalse")]
public class AppRoute0Request {
    public string partnerId { get; set; }
    
    public string id { get; set; }
    
}

The ReturnFalse matcher is defined in the AppHost (Startup.cs)

public class AppHost : AppHostBase
{
    ...
    // Configure your AppHost with the necessary configuration and dependencies your App needs
    public override void Configure(Container container)
    {
        // enable server-side rendering, see: https://sharpscript.net/docs/sharp-pages
        Plugins.Add(new SharpPagesFeature {
            EnableSpaFallback = false
        }); 

        SetConfig(new HostConfig
        {
            AddRedirectParamsToQueryString = true,
            DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), HostingEnvironment.IsDevelopment()),
        });

        Config.RequestRules.Add("ReturnFalse", req => { 
            Console.WriteLine("GOT HERE");
            return false;
        });
    }
}

However, the route ends up going through anyways (ignoring that the rule returns false) and there is no log. Even when debugging, it doesn’t seem to hit the matcher function.

Do you have any other conflicting routes at this path? If not can you provide the full HTTP Request/Response Headers for this request.

Upon closer inspection, the routes were returning html from wwwroot

public object Any(AppRoute2Request request) => Request.GetPageResult("/about.html");

and I serving the files directly from wwwroot has higher precedence than running the route. So the route with the URL param (the one that I originally posted) actually did run the matcher.

public object Any(AppRoute0Request request) => Request.GetPageResult("/users/[id].html");

Is there a way to not have the precedent be to serve the files from wwwroot first?

No, you’ll need to avoid routes that conflict with static files.

You can intercept requests with the RawHttpHandlers as it’s the first filter invoked in the Request pipeline.

Here’s how the SVG Feature uses this to render its custom UI: