spring-cloud / spring-cloud/spring-cloud-gateway
Support to redirect with initial request path to the redirected request in RedirectTo filter.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
Problem:
The current RedirectTo filter, takes in the following config:
spring:
cloud:
gateway:
routes:
- id: prefixpath_route
uri: https://example.org
filters:
- RedirectTo=302, https://acme.org, true
With current approach when redirection takes place it sets the response status to '302' and sets the 'Location' header to the provided URI, and also provides an option to include query param from the initial request. But this implementation drops the request path of the original request.
Ex:
Initial Request: GET http://localhost:8080/target/get?query1=value1
Redirected Request: GET https://acme.org?query1=value1
With the current implementation the initial request path is /target/get is dropped.
Proposed Solution:
Provide an option similar to includeRequestParams to indicate whether the initial request path should be included on the url. The parameter is treated as false when not set to preserve backwards compatibility.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the RedirectTo filter and its existing includeRequestParams handling. Add an optional setting for including the initial request path while preserving the current default behavior, and verify that redirects retain the path only when enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100