Match Expressions¶
A match expression is a boolean expression that determines whether a rule applies to an incoming request. It has access to all variables and functions.
If a rule has no match expression it matches every request — useful as a catch-all at the end of the rule list.
Syntax¶
Expressions use standard C# expression syntax via DynamicExpresso:
- String literals:
"value"(double quotes) - Boolean operators:
&&,||,! - Comparison:
==,!=,<,>,<=,>= - String indexer:
QueryParams["key"],Headers["name"]
Examples¶
Match a specific host:
Match a path prefix:
Match by country:
Match a numeric path segment in a range:
Match requests from a specific country that are not returning visitors:
Match via map — only redirect if the key exists in the map:
Match a query parameter:
Match using regex:
Catch-all (no expression set): Leave the match expression blank. The rule always matches.
Evaluation behaviour¶
- If the expression throws (syntax error, type mismatch), the rule is skipped and the error is recorded. Subsequent rules are still evaluated.
- Dictionary access (
QueryParams["missing"]) returns""for missing keys — it does not throw. - Geo values are
""(empty string) when GeoIP cannot resolve the IP. Rules that compareGeo.Country == "NL"will simply not match such requests.