Skip to content

fix(xds): preserve path separators in root prefix rewrites#9415

Open
immanuwell wants to merge 1 commit into
envoyproxy:mainfrom
immanuwell:fix-root-prefix-urlrewrite
Open

fix(xds): preserve path separators in root prefix rewrites#9415
immanuwell wants to merge 1 commit into
envoyproxy:mainfrom
immanuwell:fix-root-prefix-urlrewrite

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

What this PR does / why we need it

Root PathPrefix "/" rewrites are a bit busted right now. With a URLRewrite replacePrefixMatch: /prefix/, GET /test hits the backend as /prefixtest, not /prefix/test.

This switches that one case to regex rewrite. So / becomes /prefix, and /test becomes /prefix/test. Non-root prefix rewrites stay the same.

Which issue(s) this PR fixes

Fixes #6764
Related #5256

How to reproduce

  1. Apply an HTTPRoute with matches[].path.value: / and filters[].urlRewrite.path.replacePrefixMatch: /prefix/.
  2. Send GET /test.
  3. On main, the backend sees /prefixtest.
  4. With this PR, the backend sees /prefix/test.

Checks

  • go test ./internal/xds/translator -count=1
  • go test -tags=e2e ./e2e/tests -run TestNonExistent -count=1

@immanuwell immanuwell requested a review from a team as a code owner July 4, 2026 10:24
@netlify

netlify Bot commented Jul 4, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit f08d6b7
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a4923cd06bab50008011aae
😎 Deploy Preview https://deploy-preview-9415--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91403c25f4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread release-notes/current/bug_fixes/6764-root-prefix-urlrewrite.md
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.35%. Comparing base (dc73f48) to head (f08d6b7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9415      +/-   ##
==========================================
+ Coverage   75.33%   75.35%   +0.02%     
==========================================
  Files         252      252              
  Lines       41471    41480       +9     
==========================================
+ Hits        31243    31259      +16     
+ Misses       8115     8109       -6     
+ Partials     2113     2112       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: immanuwell <pchpr.00@list.ru>
@immanuwell immanuwell force-pushed the fix-root-prefix-urlrewrite branch from 91403c2 to f08d6b7 Compare July 4, 2026 15:16
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.

Cannot match / and rewrite prefix to the original path

1 participant