-
Notifications
You must be signed in to change notification settings - Fork 0
IsMyPageCached API
The API is currently under internal testing and will be made available to developers who have requested an early access.
For any given URL, it will seek to cache information across multiple caching layers and return every discovered cache layer, and HIT/MISS status, in an array.
To be determined, sorry!
Required:
url=[url]
The URL of a webpage for which we want to discover the various visible caching layers. Example: '?url=https://www.ubergizmo.com'
- 200: all good
- 206: request is valid, but no content was fetched. It could be the wrong URL, or the origin response is empty
- 400: Problem with the API request, usually a malformed URL. Make sure you use a format such as https://www.mydomain.com
- 503: Service not available. Perhaps a maintenance event
We aim to follow the JSON API standard, so our response contains a data
and an errors
properties. data
contains most of the relevant bits of information such as the caching layers. errors
can be empty, or contain an array of strings that provide more information about any detected issues.
{
"build": "BUILD_STRING",
"date_utc": "MM/DD/YYYY H:M:S am/pm",
"data": {
"site_ttfb_ms": 123,
"cache_layers": [
{
"name": "CACHE LAYER NAME",
"level": "CACHE LAYER LEVEL DESCRIPTION",
"level_int": 123,
"hit": true
}
],
"http_headers": {
"Key_1": "Value_1",
"Key_2": "Value_2"
}
},
"http_response": 123,
"errors": {
"messages": [
"error msg1"
]
}
}
-
build
: our internal build number. We use it to check which version is being deployed or is serving. -
date_utc
: the date/time at which the test was done, in the Coordinated Universal Time (UTC) timezone. It's an easy way to ensure a new test did happen, and that you're not looking at a cached API result. -
site_ttfb_ms
: the page's time to first byte (TTFB) of the page being analyzed, in milliseconds. Developers might consider adapting the frequency of the requests based on this. -
cache_layers
: an array of objects, each describing one cache layer (description below) -
http_headers
: the page's HTTP headers as fetched during the analysis
-
name
: is a human-readable description of the layer as detected. Examples: "NGINX SRCache" or "WP SuperCache" -
level
: is a human-readable description of the layer's level. possible values areplugin
webserver
orcdn
-
level_int
: is the integer representation of the layer's level. 0 =plugin
, 1 =webserver
, 2 =cdn
. This could allow developers to sort, or group layers by type. -
hit
: is a boolean that shows if the page was cached at the moment of the test. Note that if it was not cached, the test itself may have fetched it into the cache layer. A subsequent test might reveal this. -
age
(optional): the length of time that the page was stored in the cache layer. Not all caching systems provide this information.
Example with ONE cache layer: ?url=https://www.ubergizmo.com
{
"build": "1.016",
"date_utc": "07/10/2021 03:39:20 am",
"data": {
"site_ttfb_ms": 118,
"cache_layers": [
{
"name": "Fastly",
"level": "cdn",
"level_int": 2,
"hit": true,
"age": 97
}
],
"http_headers": {
"0": "http/1.1 200 ok",
"8": "x-cacheable: yes:backend-controlled",
"10": "date: sat, 10 jul 2021 03:39:20 gmt",
"accept-ranges": "bytes",
"age": "97",
"cache-control": "max-age=0, max-age=0",
"connection": "close",
"content-length": "173345",
"content-type": "text/html; charset=utf-8",
"server": "apache/2.4",
"vary": "accept-encoding, fastly-ssl",
"via": "1.1 varnish",
"x-cache": "hit",
"x-cache-hits": "1",
"x-frame-options": "sameorigin",
"x-served-by": "cache-sjc10068-sjc",
"x-ubermaxage": "1800"
}
},
"http_response": 200,
"errors": []
}
Example with TWO cache layers: ?url=https://www.thefooddictator.com/
{
"build": "1.016",
"date_utc": "07/10/2021 03:40:22 am",
"data": {
"site_ttfb_ms": 284,
"cache_layers": [
{
"name": "Nitropack",
"level": "plugin",
"level_int": 0,
"hit": true
},
{
"name": "Cloudflare APO",
"level": "cdn",
"level_int": 2,
"hit": false
}
],
"http_headers": {
__HEADERS_HERE___
}
},
"http_response": 200,
"errors": []
}