Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gatsby: disappearing url parameters from email link

I'm developing a site in Gatsby. Users receive an email with a link containing a single-use token, like this:

https://www.example.com/approval?token=hIPdI7oSw6KV6k8ttsXG3XAHmIqExyB01YkChxiLR9leksJ67iRme6yyxfBztz3Z

This should take them to the approval page and supply the token as parameter.

It works fine in the development build, but in the production build the parameter is missing from the url and the user is simply directed to https://www.example.com/approval

Does anyone know why Gatsby might be re-writing the url without the parameter in the production build, and is there some way to prevent that from happening?

EDIT: This site is hosted on CloudFront, and we've enabled forwarding of query params. Possibly there are some a re-direct happening at another level?

like image 548
d13 Avatar asked Nov 01 '25 06:11

d13


1 Answers

It turned out to be Gatsby/CloudFront madness: https://github.com/gatsbyjs/gatsby/issues/20139

The Gatsby dev server was unhelpfully injecting a / in front of the ?. The production build on CloudFront wasn't doing that, triggering a re-direct. CloudFront requires query strings in the format /? - for future reference!

like image 183
d13 Avatar answered Nov 04 '25 10:11

d13



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!