Skip to content

redirectTo filter is inconsistent. #3430

@xavivars

Description

@xavivars

Describe the bug
redirectTo filter behaves inconsistently when dealing with query strings.

slack conversation

Test case 1.
If I define the filter like redirectTo(301, "https://example.com/"), for a route that matches mydomain.com, with url https://mydomain.com/incoming=true, I'll get a redirect to https://mydomain.com/?incoming=true. That is, query strings from the incoming request are propagated. There's no way to disable query string propagation.

Test case 2.
If I define the filter like redirectTo(301, "https://example.com/filter=true"), for a route that matches mydomain.com, with url https://mydomain.com/, I'll get a redirect to https://mydomain.com/?filter=true. That is, query strings from the filter are propagated.

Observed behavior

Test case 3. (the one broken, IMHO)

If I define the filter like redirectTo(301, "https://example.com/filter=true"), for a route that matches mydomain.com, with url https://mydomain.com/?incoming=true, I'll get a redirect to https://mydomain.com/?filter=true. That is, incoming query strings are lost.

Expected behavior

My expectation is that incoming query strings are propagated, and the final URL is a combination of query strings from filter and from incoming URL.

So, if I define the filter like redirectTo(301, "https://example.com/filter=true"), for a route that matches mydomain.com, with url https://mydomain.com/?incoming=true, my expectation would be to get a redirect to https://mydomain.com/?filter=true&incoming=true.

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