Using query parameters in a redirect

Hello again!

I’m having some trouble with redirects. I simply want to redirect (netlify site) example.com/rich/login to http://localhost:3000/callback. This far it’s working fine, but the rich/login path always has parameters (?code=…&state=…). However, these are not being appended to the /callback url. This is my current redirect:

[[redirects]]
  from = "/rich/login/*"
  to = "https://localhost:35893/callback/:splat"

How do I add the query parameters in the rewrite rule? (I don’t want them to be like /code/state like the docs mention, they have to be appended as usual with ? and &)

hi there, before we dig in, did you see this brand new guide on debugging redirects?

I strongly suggest you give it a thorough read through and see if it contains the info you need?

if not, please post again, and we’ll try and troubleshoot.

Fixed, thank you. Somehow I missed the warning in the redirects documentation. Sorry for that :s

For anyone finding this:

Query strings are not automatically passed to our redirect engine. Therefore, they must be explicitly defined.

I used the following to fix it:

[[redirects]]
  from = "/rich/login/*"
  to = "https://localhost:35893/callback?code=:code&state=:state"
  query = {code = ":code", state = ":state"}