Use cases and best practices

Use case: set up a rule for your custom site

Based on the newly added custom hostname discussed in Create a new edge hostname, you'd typically add a corresponding set of rules. Appending this simple example to the rule's array of children as part of a PUT request tests the hostname and assigns a different CP code to report on and separately bill for the custom site's traffic.

{
    "name": "Custom Site",
    "criteria": [
        {
            "name": "hostname",
            "options": {
                "matchOperator": "IS_ONE_OF",
                "values": [ "custom.example.com" ]
            }
        }
    ],
    "behaviors": [
        {
            "name": "cpCode",
            "options": {
                "value": {
                    "id": 54321,
                    "name": "custom site"
                }
            }
        }
    ]
}

👍

While the hostname criteria matches hostnames, the clientIp criteria matches IP addresses.