Skip to content

docs(2.1.x): replace unsupported regex rewrite section#792

Open
anvithagowda098 wants to merge 2 commits into
kgateway-dev:mainfrom
anvithagowda098:fix-regexsection-v2.1
Open

docs(2.1.x): replace unsupported regex rewrite section#792
anvithagowda098 wants to merge 2 commits into
kgateway-dev:mainfrom
anvithagowda098:fix-regexsection-v2.1

Conversation

@anvithagowda098

Copy link
Copy Markdown
Contributor

Description

The TrafficPolicy urlRewrite field does not exist in v2.1.x . The Regex rewrite section on the v2.1.x path rewrites page incorrectly documented this feature, causing API errors for users who followed it.

Replaced the entire Regex rewrite section with a callout noting the feature is unavailable in v2.1.x and pointing users to the supported ReplacePrefixMatch and ReplaceFullPath alternatives. Also removed the corresponding TrafficPolicy cleanup command.

Fixes kgateway-dev/kgateway#13452

Change Type

/kind documentation

Additional Notes

Only the 2.1.x version of the page is affected. The 2.2.x and latest pages are correct and unchanged.

Signed-off-by: Anvitha <anvitha.gowda098@gmail.com>
@anvithagowda098 anvithagowda098 marked this pull request as draft May 27, 2026 02:48
@anvithagowda098

Copy link
Copy Markdown
Contributor Author

Instead of duplicating the entire assets/docs/pages/traffic-management/rewrite/path.md, I'm trying to keep the shared assets template intact and use {{< version exclude-if="2.1.x" >}} to hide the Regex rewrite section on 2.1.x.

But the problem is that Hugo loses heading rendering for ##/### headings inside version blocks that contain nested shortcodes so wrapping the whole thing breaks things. I also checked the repo and couldn't find an existing example of an entire ## section being hidden this way.

Would extracting the regex rewrite content into assets/docs/snippets/regex-rewrite.md and calling {{< reuse >}} inside the exclude-if block work here? Or is there a preferred pattern for this?

@artberger @kristin-kronstain-brown

@kristin-kronstain-brown

Copy link
Copy Markdown
Contributor

@anvithagowda098 Have you tried changing {{< version exclude-if="2.1.x" >}} to {{% version exclude-if="2.1.x" %}} yet? That seems to help with those kind of rendering issues sometimes.

@anvithagowda098

Copy link
Copy Markdown
Contributor Author

@kristin-kronstain-brown does not work either. Extracting the regex rewrite content into snippet breaks as well. Appears to me as if the current PR is the right solution.

@anvithagowda098 anvithagowda098 marked this pull request as ready for review June 4, 2026 08:31
@kristin-kronstain-brown

Copy link
Copy Markdown
Contributor

@anvithagowda098 Thanks for tracking this down. Yeah, the version shortcodes can be tricky. I've been working on trying to get that working better, but for this instance, I think it's fine to go without them and just copy over the content. It's an older version and the later versions do still use the shared asset file. As I was starting to go through the shared topic for comparison, I noticed some issues with that one. Can you make sure your version corrects the same things I did in the asset file for the other versions?
https://github.com/kgateway-dev/kgateway.dev/pull/835/files

Signed-off-by: Anvitha <anvitha.gowda098@gmail.com>
@anvithagowda098

Copy link
Copy Markdown
Contributor Author

@kristin-kronstain-brown made the necessary changes!

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.

TrafficPolicy urlRewrite.pathRegex field missing in v2.1.2 CRD but documented

2 participants