question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disabling MiniProfiler header for specific endpoints

See original GitHub issue

This 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:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
NickCravercommented, Sep 16, 2020

@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

0reactions
NickCravercommented, Sep 16, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Is it possible to disable mini profiler handler?
I know that i can skip starting profiler for the request but still endpoints to results are available (exception is thrown but they...
Read more >
Removing header from backend request causes exception
Describe the bug My application wants to rewrite the html returned from the backend. This is handled in a transform and is working...
Read more >
MiniProfiler/rack-mini-profiler
It works by enabling invisible profiling on one request every N requests, and saving the performance metrics that are collected during the request...
Read more >
Is there any possibility to enable/disable the Miniprofiler ...
I have used showControls:true, startHidden:true, but it doubles up the [m | c] button on each pofiler result.
Read more >
.Net5 Application Query Tracing Using MiniProfiler
For MiniProfiler the default path is '/mini-profiler-resources/results', but we have an option to override 'mini-profiler-resources' part of the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found