Example request body for a policy

Each "create or update a policy" operation via the ACE API requires a properly formatted request body.

This example assumes you're creating a policy that does the following for a new subcustomer whose hostname is www.example.com:

  • It defines an origin domain. The subcustomer origin hostname is c1234567.cloudprovider.com. Also, we want to ensure that the incoming request Host header is sent to the origin.
  • It sets a default caching policy. This is set to no-store, which presumes HTML pages and other content not defined as cacheable elsewhere in the policy is dynamic in nature.
  • It applies a custom one day TTL for certain content. This is applied for all PNG, GIF and JPG images in the /static/* directory.
  • It applies another separate one hour TTL. This is applied for all CSS and JS files in the /static/* directory
  • It blocks clients in North Korea.

If so, the JSON you must include with this operation might look like the following:

{
    "rules" : [ 
        {
            "matches" : [
                {
                    "name" : "url-wildcard",
                    "value" : "/*"
                }
            ],
            "behaviors" : [
                {
                    "name" : "origin",
                    "value" : "-",
                    "params" : 
                        {
                            "digitalProperty" : "www.example.com",
                            "originDomain" : "c1234567.cloudprovider.com",
                            "cacheKeyType" : "origin",
                            "hostHeaderType" : "digital_property",
                            "hostHeaderValue" : "-",
                            "cacheKeyValue" : "-"
                        }
                    },
                {
                    "name" : "caching",
                    "type" : "no-store",
                    "value" : "-"
                }, 
                {
                    "name" : "geo-blacklist",
                    "type" : "country",
                    "value" : "KP"
                }
            ]
        },
        {
            "matches" : [
                {
                    "name" : "url-wildcard",
                    "value" : "/static/*"
                },
                {
                    "name" : "url-extension",
                    "value" : "png gif jpg"
                }
            ],
            "behaviors" : [
                {
                    "name" : "caching",
                    "type" : "fixed",
                    "value" : "86400s"
                }
            ]
        },
        {
            "matches" : [
                {
                    "name" : "url-wildcard",
                    "value" : "/static/*"
                },
                {
                    "name" : "url-extension",
                    "value" : "css js"
                }
            ],
            "behaviors" : [
                {
                    "name" : "caching",
                    "type" : "fixed",
                    "value" : "3600s"
                }
            ]
        }
    ]
}

The response, if successful, will repeat the JSON structure representing the complete (unformatted) policy.