I want to strip url params before send it to proxy_pass
For visitor request url: => https://example.com/?wanted1=aaa&unwanted1=bbb&unwanted2=ccc&wanted2=ddd
Then it strip all the unwanted params to: => https://example.com/?wanted1=aaa&wanted2=ddd
My current way is like this:
if ($args ~ ^(.*)&(?:unwanted1|unwanted2)=[^&]*(&.*)?$ ) {
set $args $1$2;
}
But It only remove 1 param and never do recursion. How to solve this? I want to modify the $args.