-
Notifications
You must be signed in to change notification settings - Fork 378
Description
Describe the bug
redirectTo filter behaves inconsistently when dealing with query strings.
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.