Respect path prefix when matching paths - #223
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates path-dependent behaviors (health check request detection, excluded-metrics path matching, and proxy path rewriting) to account for services deployed under a stripped path prefix, so comparisons are made against the upstream/target’s view of the request path.
Changes:
- Introduces
RoutedTargetPathand uses it for health check matching, metrics exclusion matching, and reverse-proxy path rewriting when a matched prefix is stripped. - Adds test coverage for health check and excluded-metrics behavior when a matched prefix is present and
StripPrefixis enabled. - Documents that excluded paths should be specified as the upstream receives them (i.e., un-prefixed when prefixes are stripped).
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Clarifies how to specify excluded paths when prefixes are stripped. |
| internal/server/testing.go | Adds a test helper to attach a matched-prefix routing context to requests. |
| internal/server/target.go | Uses routed/stripped target path for health-check detection and proxy rewriting. |
| internal/server/target_test.go | Adds assertions covering health check matching under a stripped prefix. |
| internal/server/service.go | Uses routed/stripped target path for metrics-exclusion matching. |
| internal/server/service_test.go | Adds assertions covering metrics exclusion under a stripped prefix. |
| internal/server/router.go | Adds RoutedTargetPath helper used across path-dependent decisions. |
| internal/server/router_test.go | Adds integration coverage for paused health checks with path prefixes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There are a couple places where behviour is dependent on whether a request path matches a configured value: identifying incoming health check requests; and identifying paths for which metrics should not be tracked. In both of these cases, if an app is deployed under a path prefix (and strips the prefix) then the expected behaviour is that we match that path against what the upstream sees. So we need to factor in any prefix-stripping before paths are matched.
kevinmcconnell
force-pushed
the
respect-path-prefix-in-matching
branch
from
July 16, 2026 07:57
7683ad6 to
cb4fd87
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are a couple places where behviour is dependent on whether a request path matches a configured value: identifying incoming health check requests; and identifying paths for which metrics should not be tracked.
In both of these cases, if an app is deployed under a path prefix (and strips the prefix) then the expected behaviour is that we match that path against what the upstream sees. So we need to factor in any prefix-stripping before paths are matched.