Preserve query parameters on redirect

Hi,
Has there been still any update on this?

Hi, @devLuko. Not yet. We’ll post an update here if/when there is a change.

Hey Netlify team,

Is there any progress on this? Even a schedule of when you plan to tackle it would help. As time goes on, preserving query params becomes more and more important for us, as we expand our campaign efforts, and move into new regions. We are coming up on a renewal, and I know this will come up as a hot topic, as most traditional systems will support this by default.

Not to mention, I have a few tests going that indicate to me that the base functionality we are supposed to have isn’t working correctly or consistently. I’m also curious if redirects are cached, and if so, how that affects the systems ability to forward query params.

Thanks!

-Josh-

1 Like

We don’t publish timelines on major projects like these. I can tell you more than that, but none of it will be a promised delivery date:

  1. we started working on code to enable this some time ago, but there are a lot of needed pieces, requiring many developer-months to get designed, developed, tested, stabilized, and production ready.
  2. this is an area of our code that ALREADY has several implementations which we are trying to be as backwards compatible with as possible in this new version, which complicates the process substantially.
  3. we have a large scale overhaul of our redirects implementation in active testing now, on our own sites, at full scale. Aside from that testing, development and production-readiness work on the project, from a sizable portion of our engineering organization, is also actively in progress today.
  4. once that change is live, we’ll be able to implement this feature.
  5. once the feature is available, we will post here IMMEDIATELY, so you do not need to poll.

In the meantime, you can individually handle your query params in your redirects, as documented here: Redirect options | Netlify Docs

Redirect caching is a large topic. Could you tell me what you are observing so I can speak to only the relevant parts?

I saw this:

Query string parameters are not automatically passed to our redirect engine. To use query parameters in redirects, you must specify rules with the exact set of parameters you are expecting.

Is that still up to date? We would need to pass existing query strings from one page to the redirected page, and have hundreds of them so specifying matching rules for each one would be error prone.

hey there, did you see this update we posted not too long ago?

1 Like

I did not see it! This is great. In that post it says it was turned off, is it back on now?

hey @uhawaii - sorry, i didn’t realize we had to switch that functionality back off again when i suggested that post.

I’m trying to get a bit more information on the status of this at the moment for you.

1 Like

Thank you! Looking forward to an update

Hi, @uhawaii. We have this topic cross-linked with the issue tracking the change. If/when it is enabled again, we will post an update here to let you know about it.

Any chance you could provide more details about what went wrong? I’m confused b/c in the post you say it is “one of our most frequently requested features”, and you build it, then rolled it back, now say “if” we enable it again. I totally get that it might be too complex, but we will have to dedicate and plan decent engineering resources to work around this or exlpore differen cdns, so some more info would help a lot with our planning process! Thanks for the updates so far and again if it’s not going to happen soon I get it, just would be very helpful to know.

Nothing specific to report, only the changes broke other working aspects of the service. We simply say if/when because we’re not part of the project team working on the larger deliverables – though we have added our customer’s voices. We don’t want to promise something that we don’t have the final decision on, is all.

1 Like

Is this related to the wiping of referrer data when using the Pretty URL asset optimization? I noticed today that document.referrer is empty when navigating to a url without a trailing slash that is then redirected to the same url with a trailing slash. This is concerning since this means our referrer analytics data has been affected for the 6 mos we’ve had this optimization enabled. If this is intended behavior it would be useful to document that somewhere (or maybe it is and I missed it).

1 Like

2 week ping. Any word? Any chance someone from the dev team could drop a line or two about what happened and why it was nixed? If for nothing else just for the technical curiosity

hey there, thanks for your interest~

Looking at our internal issue, I see that we switched this off because we are waiting on the rollout of some bigger changes that will make this change a bit more stable and less error prone. I can’t share more details at the moment, but we do plan on bringing this back as soon as some other upgrades are in place.

1 Like

Makes sense! A common and understandable reason, and usually things like that are worth the wait.

1 Like

FYI for those looking, this feature has been re-enabled and should be live once again:


Jon

Maybe it is because I am in development, but I still have this issue.

netlify -v
$ netlify-cli/2.69.11 darwin-x64 node-v12.16.3
# netlify.toml
[build]
  functions = "serverless"

[[redirects]]
  from = "/api/*"
  to = "/.netlify/functions/express/:splat"
  status = 308

We don’t necessarily support all the “special” redirect codes like 308 (or 314). Could you try it with a 301 or 302 instead please, and let me know how well it works for you? You are also a major version behind in our CLI so you’ll need an upgrade to the latest as well since this is a very recent change!

Hi everyone, I’ve implemented the following in our netlify.toml file:

[[redirects]]
  from = "/"
  to = "/fr?utm_source=:source&utm_medium=:medium&utm_campaign=:campaign"
  force = true
  query = { utm_source = "source", utm_medium = "medium", utm_campaign = "campaign" }

From my tests, any combination of these 3 query parameters (including 2, 1 and no query parameters) in the URL lead to a correct URL. Am I missing something, or is this indeed enough to redirect for all these 3 parameters?