From 7c275f59b84c8ff14adf9f24853d8471127c757d Mon Sep 17 00:00:00 2001 From: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:46:52 -0500 Subject: [PATCH] Fixing docs --- .../redirectto-factory.adoc | 20 ++++++++++++++++++- spring-cloud-gateway-server/pom.xml | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/spring-cloud-gateway/gatewayfilter-factories/redirectto-factory.adoc b/docs/modules/ROOT/pages/spring-cloud-gateway/gatewayfilter-factories/redirectto-factory.adoc index 5753f61793..72db53f2f3 100644 --- a/docs/modules/ROOT/pages/spring-cloud-gateway/gatewayfilter-factories/redirectto-factory.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-gateway/gatewayfilter-factories/redirectto-factory.adoc @@ -1,10 +1,12 @@ [[redirectto-gatewayfilter-factory]] = `RedirectTo` `GatewayFilter` Factory -The `RedirectTo` `GatewayFilter` factory takes two parameters, `status` and `url`. +The `RedirectTo` `GatewayFilter` factory takes three parameters, `status`, `url`, and optionally `includeRequestParams`. The `status` parameter should be a 300 series redirect HTTP code, such as 301. The `url` parameter should be a valid URL. This is the value of the `Location` header. +The `includeRequestParams` parameter indicates whether request query parameters should be included on the `url`. +When not set, it will be treated as `false`. For relative redirects, you should use `uri: no://op` as the uri of your route definition. The following listing configures a `RedirectTo` `GatewayFilter`: @@ -23,4 +25,20 @@ spring: This will send a status 302 with a `Location:https://acme.org` header to perform a redirect. +The following example configures a `RedirectTo` `GatewayFilter` with `includeRequestParams` set to `true`. +.application.yml +[source,yaml] +---- +spring: + cloud: + gateway: + routes: + - id: prefixpath_route + uri: https://example.org + filters: + - RedirectTo=302, https://acme.org, true +---- + +When a request with query `?skip=10` is made to the gateway, the gateway will send a status 302 with a +`Location:https://acme.org?skip=10` header to perform a redirect. diff --git a/spring-cloud-gateway-server/pom.xml b/spring-cloud-gateway-server/pom.xml index 5ab1e3c632..c812ec6dd0 100644 --- a/spring-cloud-gateway-server/pom.xml +++ b/spring-cloud-gateway-server/pom.xml @@ -309,6 +309,7 @@ org.apache.maven.plugins + maven-jar-plugin 3.3.0