Skip to main content

Match Conditions

Match conditions determine when rules should be executed. They provide a flexible system for targeting specific requests based on various attributes like headers, paths, IP addresses, and more.

Overview

Control how conditions are evaluated with three logical operators:

Match Operators

Choose how multiple conditions should be combined in your matching logic

๐Ÿ”—

matchAll

AND Logic

ALL conditions must match for the rule to apply

๐Ÿ“‹ Schema
โž•

matchAny

OR Logic

ANY condition must match for the rule to apply

๐Ÿ“‹ Schema
๐Ÿšซ

matchNone

NOT Logic

NO conditions must match for the rule to apply

๐Ÿ“‹ Schema

Condition Types

37 conditions

Paths

Match against request URLs using various strategies from exact matches to wildcard patterns.

Positive condition
Negated condition

Basic Path Matching

Match exact paths for specific endpoints.
JSON
{
  "paths": [
    "/api/*",
    "/v2/users/*"
  ]
}

Path Prefix Matching

Match all paths that start with specific prefixes.
JSON
{
  "paths_startswith": [
    "/api/",
    "/admin/"
  ]
}

Exact Path Matching

Match only the exact full path.
JSON
{
  "paths_full": [
    "/health",
    "/status"
  ]
}

Wildcard Path Matching

Use wildcards for pattern-based path matching.
JSON
{
  "paths_wildcard": [
    "/api/*/users",
    "/files/*.jpg"
  ]
}

Headers

Match against HTTP request and response headers with multiple matching strategies for flexible header-based routing.

Positive condition
Negated condition

Basic Header Matching

Match specific header values exactly.
JSON
{
  "reqheader": {
    "User-Agent": [
      "mobile-app",
      "desktop-app"
    ],
    "Accept-Language": [
      "en-US",
      "en-GB"
    ]
  }
}

Header Value Matching

Alternative syntax for header value matching.
JSON
{
  "reqheader_values": {
    "Authorization": [
      "Bearer abc123"
    ],
    "X-API-Key": [
      "key1",
      "key2"
    ]
  }
}

Header Prefix Matching

Match headers that start with specific values.
JSON
{
  "reqheader_startswith_values": {
    "User-Agent": [
      "Mozilla/",
      "Chrome/"
    ],
    "X-Forwarded-For": [
      "192.168."
    ]
  }
}

Header Wildcard Matching

Use wildcards for flexible header pattern matching.
JSON
{
  "reqheader_wildcard_values": {
    "User-Agent": [
      "*mobile*",
      "*tablet*"
    ],
    "Accept": [
      "image/*"
    ]
  }
}

Exact Header Matching

Match headers with exact full values.
JSON
{
  "reqheader_full_values": {
    "Content-Type": [
      "application/json"
    ],
    "X-Requested-With": [
      "XMLHttpRequest"
    ]
  }
}

Basic Response Header Matching

Match specific response header values exactly.
JSON
{
  "respheader": {
    "Content-Encoding": [
      "gzip"
    ],
    "Server": [
      "AkamaiNetstorage"
    ]
  }
}

Response Header Value Matching

Alternative syntax for response header value matching.
JSON
{
  "respheader_values": {
    "Server": [
      "AkamaiNetstorage"
    ],
    "Content-Type": [
      "text/html"
    ]
  }
}

Response Header Prefix Matching

Match response headers that start with specific values.
JSON
{
  "respheader_startswith_values": {
    "content-type": [
      "text/"
    ]
  }
}

Response Header Wildcard Matching

Use wildcards for flexible response header pattern matching.
JSON
{
  "respheader_wildcard_values": {
    "Server": [
      "*aws*"
    ]
  }
}

Exact Response Header Matching

Match response headers with exact full values.
JSON
{
  "respheader_full_values": {
    "Content-Type": [
      "application/json"
    ],
    "X-Requested-With": [
      "XMLHttpRequest"
    ]
  }
}

Query Parameters

Match against URL query parameters for dynamic request routing and processing.

Positive condition
Negated condition

Query Parameter Existence

Check if specific query parameters are present.
JSON
{
  "query_exists": [
    "debug",
    "preview"
  ]
}

Query Parameter Values

Match specific values of query parameters.
JSON
{
  "query_values": {
    "version": [
      "v1",
      "v2"
    ],
    "format": [
      "json",
      "xml"
    ]
  }
}

Query Wildcard Matching

Use wildcards for flexible query parameter matching.
JSON
{
  "query_wildcard_values": {
    "search": [
      "*product*"
    ],
    "category": [
      "electronics*"
    ]
  }
}

Exact Query Parameter Matching

Match requests with exact query parameter values.
JSON
{
  "query_full_values": {
    "version": [
      "v1.0"
    ],
    "format": [
      "json",
      "xml"
    ]
  }
}

Query Parameter Prefix Matching

Match requests where query value starts with a value.
JSON
{
  "query_startswith_values": {
    "category": [
      "tech",
      "news"
    ],
    "tag": [
      "featured"
    ]
  }
}

Query Parameter Map Matching

Match query parameters using key-value maps for complex query string patterns.
JSON
{
  "query": {
    "action": [
      "view",
      "edit"
    ],
    "format": [
      "json"
    ]
  }
}

Geographic Matching

Match requests based on client geographic location using country, region, continent, and city codes.

Positive condition
Negated condition

Geographic Country Matching

Match requests based on client country codes using ISO 3166-1 alpha-2 format (e.g., US, GB, JP). Property Reference | Download Country Codes
Also known as: geo_country
JSON
{
  "geo": [
    "US",
    "CA",
    "GB"
  ]
}

Geographic Region-Based Matching

Match requests from specific regions using ISO 3166-2 two-letter codes (e.g., MA, CA, TX). Property Reference | Download Region Codes
Also known as: geo_region
โš ๏ธ Note: geo_region can be used as a match condition, but NOT an interpolation variable. Use {{region}} for interpolations.
JSON
{
  "region": [
    "BY",
    "IL",
    "NY"
  ]
}

Geographic Continent-Based Matching

Match requests from specific continents using two-letter codes (e.g., NA, EU, AS). Property Reference | Download Continent Codes
Also known as: geo_continent
โš ๏ธ Note: geo_continent can be used as a match condition, but NOT an interpolation variable. Use {{continent}} for interpolations.
JSON
{
  "continent": [
    "NA",
    "EU"
  ]
}

Geographic City-Based Matching

Match requests from specific cities. City names are uppercase (e.g., LONDON, NEW YORK). Property Reference | Download City Codes
Also known as: geo_city
โš ๏ธ Note: geo_city can be used as a match condition, but NOT an interpolation variable. Use {{city}} for interpolations.
JSON
{
  "city": [
    "MUNICH",
    "CHICAGO"
  ]
}

IP & ASN Matching

Match requests based on client IP addresses (IPv4/IPv6) and Autonomous System Numbers.

Positive condition
Negated condition

ASN Matching

Matches requests based on the Autonomous System Number (ASN) of the client's IP address.
JSON
{
  "asn": [
    16509,
    8075,
    13335
  ]
}

ASN Exact Matching

Match requests based on exact Autonomous System Number equality.
JSON
{
  "asn_equals": [
    "16509",
    "15169",
    "32934"
  ]
}

IPv4 Matching

Match specific IPv4 addresses or CIDR blocks.
JSON
{
  "ipv4": [
    "192.0.2.100",
    "198.51.100.0/24",
    "203.0.113.0/24"
  ]
}

IPv6 Matching

Match IPv6 addresses with full address or CIDR notation.
JSON
{
  "ipv6": [
    "2001:db8::1",
    "2001:db8::/32"
  ]
}

Match requests based on cookie names using exact, prefix, or wildcard patterns.

Positive condition
Negated condition

Request Properties

Match requests based on HTTP method, protocol scheme, and file extension.

Positive condition
Negated condition

HTTP Method Matching

Target specific HTTP methods.
JSON
{
  "method": [
    "GET",
    "POST",
    "PUT"
  ]
}

Protocol/Scheme Matching

Match requests based on protocol (HTTP/HTTPS).
Also known as: scheme
JSON
{
  "protocol": [
    "https"
  ]
}

URL Scheme Matching

Match requests based on URL scheme (http, https, or other protocols).
Also known as: protocol
JSON
{
  "scheme": [
    "https"
  ]
}

File Extension Matching

Match requests based on file extensions.
JSON
{
  "extension": [
    "jpg",
    "png",
    "gif",
    "webp"
  ]
}

Response Properties

Match based on response properties such as origin timeout status. Available in response match conditions only (onClientResponse, onOriginResponse).

Positive condition
Negated condition

Origin Timeout Matching

Match responses based on whether the origin connection has timed out. Available in response match conditions only (onClientResponse, onOriginResponse).
JSON
{
  "origin_timeout": true
}

Response Status Code Matching

Match responses based on HTTP status codes. Supports exact codes (500), ranges (502-504), and classes (5xx). Available in response match conditions only (onClientResponse, onOriginResponse).
JSON
{
  "status": [
    500,
    "502-504",
    "5xx"
  ]
}

Performance and Validation

โšกEfficient Matching

  • โœ“Use specific conditions first
  • โœ“Prefer prefix over wildcards

โš ๏ธPerformance Tips

  • โš Avoid complex wildcards
  • โš Limit array sizes
  • โš Use matchAll for quick exits

โœ…Best Practices

  • โœ“Start with simple conditions
  • โœ“Test thoroughly in staging
  • โœ“Document complex logic