Two rules, two matches, two behaviors

In this example we shows two rules, each with two match conditions, that when met will apply two behaviors.

In this first rule, the following apply:

  • Match Criteria: The URI extension must be “jpg,” “gjf,” or “png” and the request method must be GET.
  • Behaviors: Both an IP whitelist and a referrer blacklist are defined. Only requests from 198.18.48.211 and 198.18.48.212 are allowed, unless they also have a Referer header value containing “abcd.com.”
{ 
    "rules" : [
        {
            "matches" : [
                {
                    "name" : "url-extension",
                    "value" : "jpg gif png"
                },
                {
                    "name" : "http-method",
                    "value" : "GET"
                }
            ],
            "behaviors" : [
                {
                    "name" : "ip-whitelist",
                    "value" : "198.18.48.211 198.18.48.212"
                },
                {
                    "name" : "referer-blacklist",
                    "value" : "*abcd.com*"
                }
            ]
        },
        {
            "matches" : [
                {
                    "name" : "host-name",
                    "value" : "www.example.com"
                },
                {
                    "name" : "http-method",
                    "value" : "GET"
                }
            ],
            "behaviors" : [
                {
                    "name" : "ip-whitelist",
                    "value" : "198.18.48.215 198.18.48.216"
                },
                {
                    "name" : "referer-blacklist",
                    "value" : "*www.abc.com*"
                }
            ]
        }
    ]
}

In the second rule, the following apply: matches all GET requests for the hostname “www.example.com” and applies both an IP whitelist and a referrer blacklist; only requests from 198.18.48.215 and 198.18.48.216 are allowed, unless they also have a Referer header value containing “www.abc.com.”

  • Match criteria: All GET requests for the hostname, “www.example.com.”
  • Behaviors: Both an IP whitelist and a referrer blacklist are applied. Only requests from 198.18.48.215 and 198.18.48.216 are allowed, unless they also have a Referer header value containing “www.abc.com.”
{
    "rules" : 
        {
            "matches" : [
                {
                    "name" : "url-extension",
                    "value" : "jpg gif png"
                },
                {
                    "name" : "http-method",
                    "value" : "GET"
                }
            ],
            "behaviors" : [
                {
                    "name" : "ip-whitelist",
                    "value" : "198.18.48.211 198.18.48.212"
                },
                {
                    "name" : "referer-blacklist",
                    "value" : "*abcd.com*"
                }
            ]
        },
        {
            "matches" : [
                {
                    "name" : "host-name",
                    "value" : "www.example.com"
                },
                {
                    "name" : "http-method",
                    "value" : "GET"
                }
            ],
            "behaviors" : [
                {
                    "name" : "ip-whitelist",
                    "value" : "198.18.48.215 198.18.48.216"
                },
                {
                    "name" : "referer-blacklist",
                    "value" : "*www.abc.com*"
                }
            ]
        }
    ]
}