Yes -
In order to accept case insensitive query params, you will need to use JavaScript or another alternative to the ExtractVariables policy. The ignoreCase attribute you can use in the Pattern element applies to the pattern itself, not to the name of the query parameter.
Here’s what I mean: when you use ExtractVariables on a query param, you are extracting something out of the query parameter itself. You already have the value of the query parameter in a variable. It is available in request.queryparam.QueryParamName , where you can replace QueryParamName with the name of your parameter.
Therefore if the inbound request is GET /foo/bar?baz=abc2872 then the context variable request.queryparam.baz contains the value “abc2872”.
ExtractVariables allows you to extract some part of a value of a query param into another variable, according to a pattern or template that you provide. The ignoreCase attribute tells Edge to ignore the case in the provided value. An example. Suppose you use this code:
<ExtractVariables name="ExtractQuery-1">
<QueryParam name="baz">
<Pattern ignorecase="true">ABC{code}</Pattern>
</QueryParam>
<VariablePrefix>extracted</VariablePrefix>
</ExtractVariables>
…then with the same request as above, after the ExtractVariables, the context variable extracted.code will contain the value 2872. You’ve extracted a part of the complete value of the original query parameter.
To grab the value of a queryparam with a case-insensitive name, you can use a JavaScript callout that relies on the URI.js third-party URI-parsing library.
The JS Code would look like this:
// this code relies on [https://medialize.github.io/URI.js](https://medialize.github.io/URI.js)
//
// that module must be included in the policy via
// <IncludeURL>jsc://URI.js</IncludeURL>
function caseInsensitiveRetrieve(hash, key) {
key = key.toLowerCase();
var item = Object.keys(hash).find(function(element) {
return (key == element.toLowerCase());
});
return (item)?hash[item]:null;
}
var uri = new URI(context.getVariable('proxy.url'));
var vsec = caseInsensitiveRetrieve(uri.search(true), 'validitySec');
if (vsec) {
context.setVariable('extracted.validitySec', vsec);
}
And the JS policy configuration looks like this:
<Javascript name="JavaScript-1">
<IncludeURL>jsc://URI.js</IncludeURL>
<ResourceURL>jsc://extractQuery.js</ResourceURL>
</Javascript>