Append the query string when forwarding (see #5867)