Skip to content

Respect path prefix when matching paths - #223

Merged
kevinmcconnell merged 1 commit into
mainfrom
respect-path-prefix-in-matching
Jul 16, 2026
Merged

Respect path prefix when matching paths#223
kevinmcconnell merged 1 commit into
mainfrom
respect-path-prefix-in-matching

Conversation

@kevinmcconnell

Copy link
Copy Markdown
Collaborator

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.

Copilot AI review requested due to automatic review settings July 16, 2026 07:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 RoutedTargetPath and 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 StripPrefix is 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.

Comment thread internal/server/router.go
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.
Copilot AI review requested due to automatic review settings July 16, 2026 07:57
@kevinmcconnell
kevinmcconnell force-pushed the respect-path-prefix-in-matching branch from 7683ad6 to cb4fd87 Compare July 16, 2026 07:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@kevinmcconnell
kevinmcconnell merged commit 36f7942 into main Jul 16, 2026
6 checks passed
@kevinmcconnell
kevinmcconnell deleted the respect-path-prefix-in-matching branch July 16, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants