WAFGOPreparing your page
Setup guide

API documentation

DEVELOPER RESOURCES · API REFERENCE

Explore WAFGO API services, request paths and message definitions. Browse by permission role to find the parameters and response structures for your integration.

Download JSON documentation
151 services1063 interfaces

References

HTTP cache configuration

json:http_cache_config

Original definition
# HTTP cache configuration
## Definition
~~~json
{
  "isPrior": "Whether to override the parent configuration",
  "isOn": "Whether this configuration is enabled",
  "addStatusHeader": "Whether to add the cache hit status header (X-Cache)",
  "addAgeHeader": "Whether to add the Age header",
  "enableCacheControlMaxAge": "Whether to support Cache-Control: max-age=...",
  "disablePolicyRefs": "Whether to disable conditions defined in the policy",
  "purgeIsOn": "Whether to allow purging with the Purge method",
  "purgeKey": "X-Edge-Purge-Key used for purging",
  "stale": "Policy for serving stale cached content",
  "key": "Primary domain configuration",
  "cacheRefs": ["Cache condition 1", "Cache condition 2", ...]
}
~~~
Where:
* `Cache condition`: see {json:http_cache_ref}.
* `Primary domain configuration`: see the Primary domain configuration section below.

## Examples
### Without cache conditions
~~~json
{
  "isPrior": true,
  "isOn": true,
  "addStatusHeader": true,
  "addAgeHeader": true,
  "enableCacheControlMaxAge": true,
  "disablePolicyRefs": false,
  "purgeIsOn": false,
  "purgeKey": "",
  "stale": null,
  "cacheRefs": []
}
~~~

### With cache conditions
~~~json
{
  "isPrior": true,
  "isOn": true,
  "addStatusHeader": true,
  "addAgeHeader": true,
  "enableCacheControlMaxAge": true,
  "disablePolicyRefs": false,
  "purgeIsOn": false,
  "purgeKey": "",
  "stale": null,
  "cacheRefs": [
    {
	  "id": 0,
	  "isOn": true,
	  "key": "${scheme}://${host}${requestPath}${isArgs}${args}",
	  "life": {"count": 2, "unit": "hour"},
	  "status": [200],
      "maxSize": {"count": 32, "unit": "mb"},
      "minSize": {"count": 0, "unit": "kb"},
      "skipCacheControlValues": ["private", "no-cache", "no-store"],
      "skipSetCookie": true,
      "enableRequestCachePragma": false,
      "conds": {
        "isOn": true,
        "connector": "or",
        "groups": [
          {
            "isOn": true,
            "connector": "and",
            "conds": [
              {
                "type": "url-extension",
                "isRequest": true,
                "param": "${requestPathLowerExtension}",
                "operator": "in",
                "value": "[\".css\",\".png\",\".js\",\".woff2\"]",
                "isReverse": false,
                "isCaseInsensitive": false,
                "typeName": "URL扩展名"
              }
            ],
            "isReverse": false,
            "description": ""
          }
        ]
      },
      "allowChunkedEncoding": true,
      "allowPartialContent": false,
      "isReverse": false,
      "methods": []
	}
  ]
}
~~~


## Primary domain configuration
~~~json
{
  "isOn": "true|false",
  "scheme": "https|http",
  "host": "Domain name; must already be associated with the current website"
}
~~~

### Example
#### Without a primary domain
~~~json
{
  "isOn": false
}
~~~

#### With a primary domain
~~~json
{
  "isOn": true,
  "scheme": "https",
  "host": "example.com"
}
~~~

When a primary domain is enabled, it automatically replaces the domain in cache keys. Use the same primary domain when purging the cache.

Descriptions and comments follow your language. Request paths, method names, field names and types match the original API definitions.

Setup guide