feat(router): keep query string by default for redirects (#11493)

Signed-off-by: knight42 <anonymousknight96@gmail.com>

Mirrored from https://github.com/envoyproxy/envoy @ 89d6c6c6fa202aa7a01e85d2d887b56c8a3268ad
master-ci-test
data-plane-api(CircleCI) 4 years ago
parent 1d7036a86b
commit 5bcc46fd67
  1. 15
      envoy/api/v2/route/route_components.proto
  2. 15
      envoy/config/route/v3/route_components.proto
  3. 15
      envoy/config/route/v4alpha/route_components.proto

@ -1177,6 +1177,21 @@ message RedirectAction {
oneof path_rewrite_specifier { oneof path_rewrite_specifier {
// The path portion of the URL will be swapped with this value. // The path portion of the URL will be swapped with this value.
// Please note that query string in path_redirect will override the
// request's query string and will not be stripped.
//
// For example, let's say we have the following routes:
//
// - match: { path: "/old-path-1" }
// redirect: { path_redirect: "/new-path-1" }
// - match: { path: "/old-path-2" }
// redirect: { path_redirect: "/new-path-2", strip-query: "true" }
// - match: { path: "/old-path-3" }
// redirect: { path_redirect: "/new-path-3?foo=1", strip_query: "true" }
//
// 1. if request uri is "/old-path-1?bar=1", users will be redirected to "/new-path-1?bar=1"
// 2. if request uri is "/old-path-2?bar=1", users will be redirected to "/new-path-2"
// 3. if request uri is "/old-path-3?bar=1", users will be redirected to "/new-path-3?foo=1"
string path_redirect = 2 string path_redirect = 2
[(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}]; [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}];

@ -1208,6 +1208,21 @@ message RedirectAction {
oneof path_rewrite_specifier { oneof path_rewrite_specifier {
// The path portion of the URL will be swapped with this value. // The path portion of the URL will be swapped with this value.
// Please note that query string in path_redirect will override the
// request's query string and will not be stripped.
//
// For example, let's say we have the following routes:
//
// - match: { path: "/old-path-1" }
// redirect: { path_redirect: "/new-path-1" }
// - match: { path: "/old-path-2" }
// redirect: { path_redirect: "/new-path-2", strip-query: "true" }
// - match: { path: "/old-path-3" }
// redirect: { path_redirect: "/new-path-3?foo=1", strip_query: "true" }
//
// 1. if request uri is "/old-path-1?bar=1", users will be redirected to "/new-path-1?bar=1"
// 2. if request uri is "/old-path-2?bar=1", users will be redirected to "/new-path-2"
// 3. if request uri is "/old-path-3?bar=1", users will be redirected to "/new-path-3?foo=1"
string path_redirect = 2 string path_redirect = 2
[(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}]; [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}];

@ -1186,6 +1186,21 @@ message RedirectAction {
oneof path_rewrite_specifier { oneof path_rewrite_specifier {
// The path portion of the URL will be swapped with this value. // The path portion of the URL will be swapped with this value.
// Please note that query string in path_redirect will override the
// request's query string and will not be stripped.
//
// For example, let's say we have the following routes:
//
// - match: { path: "/old-path-1" }
// redirect: { path_redirect: "/new-path-1" }
// - match: { path: "/old-path-2" }
// redirect: { path_redirect: "/new-path-2", strip-query: "true" }
// - match: { path: "/old-path-3" }
// redirect: { path_redirect: "/new-path-3?foo=1", strip_query: "true" }
//
// 1. if request uri is "/old-path-1?bar=1", users will be redirected to "/new-path-1?bar=1"
// 2. if request uri is "/old-path-2?bar=1", users will be redirected to "/new-path-2"
// 3. if request uri is "/old-path-3?bar=1", users will be redirected to "/new-path-3?foo=1"
string path_redirect = 2 string path_redirect = 2
[(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}]; [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}];

Loading…
Cancel
Save