Skip to content

Improve Ignore Path Matching to Avoid False Positives #116

Description

@georgidhristov

Description

DebugProbe currently uses StartsWith when evaluating ignored paths.

This can cause unrelated endpoints to be ignored when their route begins with an ignored path value.

Current Behavior

If the following path is configured:

builder.Services.AddDebugProbe(options =>
{
    options.IgnorePaths =
    [
        "/health"
    ];
});

The following requests are ignored:

/health
/health/
/health/status

But these are also ignored:

/healthcare
/health-checks
/healthy

even though they are unrelated endpoints.

Expected Behavior

Ignore path matching should only match:

  • exact path matches
  • valid child paths beneath the configured path

For example, configuring:

/health

should ignore:

/health
/health/
/health/status

but should not ignore:

/healthcare
/health-checks
/healthy

Suggested Fix

Replace the current StartsWith matching with boundary-aware path matching.

Recommended logic:

  • Match when the request path equals the ignored path.
  • Match when the request path starts with the ignored path followed by /.
  • Do not match partial route prefixes.

Result

After this change:

  • Ignore path behavior becomes more predictable.
  • Unrelated endpoints are no longer excluded accidentally.
  • Health, readiness, and liveness endpoints continue to work as expected.
  • Route matching aligns more closely with developer expectations.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions