Disabling MiniProfiler header for specific endpoints
See original GitHub issueThis might be a weird scenario - I use MiniProfiler in my application for the user part and a separate API part. I’m completely happy with how the user portion is working however the API portion, while I am tracking the profiling information I want on the server, it is sending through the headers for client side performance tracking.
Is there a way to disable the X-MiniProfiler-Ids
header for a specific path?
I tried options.IgnoredPaths.Add("/api/");
however that disabled profiling entirely. I know there is the MaxUnviewedProfiles
setting and I could tweak that lower to avoid as many headers being sent though that seems more like a last-ditch effort rather than a solution.
If this doesn’t sound too weird and the functionality doesn’t exist, I’m happy to propose a PR adding something like this - probably similar to how the ShouldProfile
option works by passing a Func<HttpRequest, bool>
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
@Turnerj I’m confused by this request still, is your config not working as intended and not rendering the headers? (even in non-dev? given that’s always true). Anything not authorized should not render the headers: https://github.com/MiniProfiler/dotnet/blob/main/src/MiniProfiler.AspNetCore/MiniProfilerMiddleware.cs#L191
No worries at all just thought I was crazy 😃 Glad you got it sorted! If that doesn’t do what you need in the end, please shout.