I’d like to create a string to pass to the names
parameter of querystring.filter_except
, so I can conditionally allow some query parameters depending on the route, or whether they match a certain validation. A bit like this:
// declare var.allowed_params
if (req.url.path ~ "routeA") {
set var.allowed_params = var.allowed_params + querystring.filtersep() + "paramA";
}
if (querystring.get(req.url, "paramB") ~ "\d+") {
set var.allowed_params = var.allowed_params + querystring.filtersep() + "paramB";
}
// ...
set req.url = querystring.filter_except(req.url, var.allowed_params);
However, I get errors saying that querystring.filtersep()
can’t be used outside of filter_except
and filter
.
Is there a reason for this restriction? Is there a workaround to help me implement something close to my idea?