Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions kubernetes/customresourcedefinitions.gen.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions networking/v1/virtual_service_alias.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 50 additions & 3 deletions networking/v1alpha3/virtual_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions networking/v1alpha3/virtual_service.pb.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions networking/v1alpha3/virtual_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1074,10 +1074,35 @@ message TLSMatchAttributes {
// ...
// ```
//
// The following rule redirects requests with a path prefix of /foo to the
// authority foo.example.com, stripping the /foo prefix from the path:
//
// ```yaml
// apiVersion: networking.istio.io/v1
// kind: VirtualService
// metadata:
// name: foo-redirect
// spec:
// hosts:
// - example.com
// http:
// - match:
// - uri:
// prefix: /foo/
// redirect:
// authority: foo.example.com
// prefix_rewrite: /
// ```
//
// With this rule, a request to example.com/foo/bar is redirected to
// foo.example.com/bar.
//
message HTTPRedirect {
// On a redirect, overwrite the Path portion of the URL with this
// value. Note that the entire path will be replaced, irrespective of the
// request URI being matched as an exact path or prefix.
//
// Mutually exclusive with prefix_rewrite.
string uri = 1;

// On a redirect, overwrite the Authority/Host portion of the URL with
Expand Down Expand Up @@ -1106,6 +1131,17 @@ message HTTPRedirect {
// On a redirect, Specifies the HTTP status code to use in the redirect
// response. The default response code is MOVED_PERMANENTLY (301).
uint32 redirect_code = 3;

// On a redirect, replace the matched prefix with this value. The route match
// must use a prefix match type. The matched prefix is stripped from the path
// and this value is prepended.
//
// Examples (route prefix match: /foo):
// - prefix_rewrite: /bar → /foo/baz becomes /bar/baz
// - prefix_rewrite: / → /foo/baz becomes //baz (use /foo/ match to get /baz)
//
// Mutually exclusive with uri.
string prefix_rewrite = 7;
}

// HTTPDirectResponse can be used to send a fixed response to clients.
Expand Down
27 changes: 27 additions & 0 deletions networking/v1beta1/virtual_service_alias.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions releasenotes/notes/redirect-prefix-rewrite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: release-notes/v2
kind: feature
area: traffic-management
issue:
- 47500
- 47777
- 52521

releaseNotes:
- |
**Added** `prefix_rewrite` field to `HTTPRedirect`, allowing redirects that preserve the path
suffix. The matched route prefix is stripped and replaced with the specified value (e.g.
`example.com/foo/bar` → `foo.example.com/bar`). Mutually exclusive with the existing `uri` field.