Skip to content

Commit

Permalink
Fixing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjbaxter committed Dec 5, 2023
1 parent 3eae3ea commit 7c275f5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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`:

Expand All @@ -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.
1 change: 1 addition & 0 deletions spring-cloud-gateway-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
Expand Down

0 comments on commit 7c275f5

Please sign in to comment.