Skip to content

Support to redirect with initial request path to the redirected request in RedirectTo filter. #3492

Open
@KartikPandit

Description

@KartikPandit

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions