Skip to content

Support for range based header matching while routing requests #2418

@kavyako

Description

@kavyako

We have a requirement to perform header match if the value of a header is within a given range.

Today, route match happens based on the header's value (exact string comparison or regex matching). Can we add range as a third option there?

Something like: In the route config, headers section, range is specified as the lowKey and highKey. A match will happen if the header's value in the incoming request lies within the range.

Some options to implement this:

  1. Range is specified in the route headers value field as a comma delimited string of the form "lowKey,highKey" and the range entry is true. 'range' is false by default. . Example below, if the incoming request contains a header PartitionKey:5, this route is matched.
{
"name": "PartitionKey",
"value": "1,10",
"regex": false,
"range": true
}
  1. Another option is to have value as a JSON object and add a valueType entry which can be set to default, regex or range. When 'valueType='regex|default value is a string.
{
"name": "PartitionKey",
"value": {"low":1,"high":10},
"valueType": "range",
"regex": false, // possibly deprecate in the future
}

This will be a breaking change though.

Would love to hear any other suggestions as well. If we have consensus on the approach, I can take a stab at adding this support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature requests. Not bugs or questions.help wantedNeeds help!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions