Quantcast
Channel: Nginx Forum - Other discussion
Viewing all articles
Browse latest Browse all 972

Preserve only specific query string params

$
0
0
Dear nginx support,

I am struggling how to setup nginx in order to preserve some specific group of query string params and at the same time to remove all the other present query params in origin url.
In specific I would like to only keep following query params in Url:

utm_source
utm_medium
utm_campaign
___store
dclid

All the other params should be stripped off.

Let's say I have Url https://www.example.com/de/aktionen/?id=8&&utm_source=newsletter&utm_medium=email&utm_campaign=aktionennewsletter_fr

This Url should be changed to https://www.example.com/de/aktionen/?utm_source=newsletter&utm_medium=email&utm_campaign=aktionennewsletter_fr (i.e "id=8" would be stripped off)

Problem is that I DO NOT KNOW which specific param could be called by end-user. In above example it is "id=8" but on he other hand I see in access.log also e.g.

https://www.example.com/de/qualitaet/qualitaetsanspruch/testergebnisse/?kh=191212145210061982&l=de&o=0&a=12211026094918233309&utm_source=newsletter&utm_medium=email&utm_campaign=aktionennewsletter_de

In this case I see more unwanted query params ( "kh=191212145210061982" and "l=de" and "o=0" and "a=12211026094918233309" ) that I want to strip off to final URL https://www.example.com/de/qualitaet/qualitaetsanspruch/testergebnisse/?utm_source=newsletter&utm_medium=email&utm_campaign=aktionennewsletter_de

Basic question from my side: Is it possible to setup some general config rule that would only preserve whitelisted params - "utm_source" ,
"utm_medium" , "utm_campaign" , "___store" , "dclid" - and all the other query params would be stripped off?

Thank you for any help

Viewing all articles
Browse latest Browse all 972

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>