Preserve Query String doesn't work in Redirect Rules

I am attempting to create a Redirect Rule to send traffic from an old subdomain to a new one along with the query string.

ie: https://www.domain2.com/Lookup.aspx?page=1&name=Jim

The rule works, but it does not append the query string even though I have the box ticked.

I found a solution on here that says he had to change the destination to Dynamic and use the following expression:

concat("https://www.domain2.com",http.request.uri.path)

This worked for me, but shouldn’t the “Preserve query string” option do this? Does it not work or am I misunderstanding the purpose?

A query string is the part from the ? in a URL like…
https://example.com/showuser?name=Jim&page=1.

Since your URL format uses a slash, you don’t have a “query string” but are passing parameters in the path.

Sorry, I mistyped my example URL. I’ve edited my post to show the correct version.

It should work: I have a rule with dynamic action set to concat("https://example.com", http.request.uri.path) with “Preserve query string” enabled, and I see the right redirect:

% curl -svo /dev/null "https://redacted.com/myredirect?true=false"
...
< HTTP/2 301 
< date: Fri, 06 Dec 2024 18:12:20 GMT
< content-type: text/html
< content-length: 167
< location: https://example.com/myredirect?true=false
< cache-control: max-age=3600
< expires: Fri, 06 Dec 2024 19:12:20 GMT
< server: cloudflare
< cf-ray: 8ede3e5e1cf37196-LHR

Having said that, there is a much easier way to do this: Redirect requests to a different hostname · Cloudflare Rules docs.