I have a NextJs application and I am hoping to add password authentication for pages with the query ?preview=true present. I would like to authenticate pages that have this query since they contain draft data usually and is just for content creators to see what something looks like.
I have done this in the past for full pages like for=‘/preview’ but not for query parameters. Is that even possible? I tried adding something like this for = “/.[?&]preview=true.” and then tested on a deployment preview link: Our Train Vacation Brochures, Via Rail & Rocky Mountaineer, and it did not ask for any authentication.
How can I fix this or add this authentication? Any help will be appreciated!