Skip to content

Commit ccff59b

Browse files
dosmanakivanmatmati
authored andcommitted
DOC/MEDIUM: #489 allow multiple rewrites in single annotation
1 parent effdda4 commit ccff59b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

documentation/annotations.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,7 @@ Possible values:
10511051

10521052
- A single path, such as "/", to turn any path into "/"
10531053
- Two parameters. A regular expression to match and a path to replace it with.
1054+
- Multiline annotation is split into more rewrite rules.
10541055

10551056
Example:
10561057

@@ -1059,6 +1060,12 @@ path-rewrite: "/" # replace all paths with /
10591060
path-rewrite: (.*) /foo\1 # add the prefix /foo... "/bar?q=1" into "/foo/bar?q=1"
10601061
path-rewrite: ([^?]*)(\?(.*))? \1/foo\2 # add the suffix /foo ... "/bar?q=1" into "/bar/foo?q=1"
10611062
path-rewrite: /foo/(.*) /\1 # strip /foo ... "/foo/bar?q=1" into "/bar?q=1"
1063+
# strip /foo ... "/foo/bar?q=1" into "/bar?q=1" and replace "/bar/*" with "/baz/*"
1064+
# with multiline (using `|`) annotation
1065+
path-rewrite: |
1066+
/foo/(.*) /\1
1067+
/bar/(.*) /baz/\1
1068+
10621069
```
10631070
10641071
<p align='right'><a href='#available-annotations'>:arrow_up_small: back to top</a></p>

documentation/doc.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,7 @@ annotations:
11051105
values:
11061106
- A single path, such as "/", to turn any path into "/"
11071107
- Two parameters. A regular expression to match and a path to replace it with.
1108+
- Multiline annotation is split into more rewrite rules.
11081109
applies_to:
11091110
- configmap
11101111
- ingress
@@ -1114,6 +1115,12 @@ annotations:
11141115
- 'path-rewrite: (.*) /foo\1 # add the prefix /foo... "/bar?q=1" into "/foo/bar?q=1"'
11151116
- 'path-rewrite: ([^?]*)(\?(.*))? \1/foo\2 # add the suffix /foo ... "/bar?q=1" into "/bar/foo?q=1"'
11161117
- 'path-rewrite: /foo/(.*) /\1 # strip /foo ... "/foo/bar?q=1" into "/bar?q=1"'
1118+
- |
1119+
# strip /foo ... "/foo/bar?q=1" into "/bar?q=1" and replace "/bar/*" with "/baz/*"
1120+
# with multiline (using `|`) annotation
1121+
path-rewrite: |
1122+
/foo/(.*) /\1
1123+
/bar/(.*) /baz/\1
11171124
- title: pod-maxconn
11181125
type: number
11191126
group: maximum-concurrent-backend-connections

0 commit comments

Comments
 (0)