@superherocheesecake/cache-validator
v1.0.2
Published
Validates cache settings against Superhero Cheesecake standards
Downloads
0
Maintainers
Keywords
Readme
Cache Validator
This CLI util will validate CDN/cache settings on a website, by default using the standard Superhero Cheesecake caching strategy patterns for CloudFront.
The tool will load the user specified url, render the webpage, and execute javascript. Then individual requests will be checked against the cache settings as specified in the config.
Get the tool (installs globally)
npm i @superherocheesecake/cache-validator -g
Basic Usage
validate-cache --url https://superherocheesecake.com
Options
url
default is https://superherocheesecake.com
--url=url
cachePatterns
It is possible to specify a custom cache pattern config to allow custom cache settings and CDN provider to be validated. This parameter requires a path to a config JSON file.
--cachePatterns=cachePatternsConfigJSON
Custom configuration
The default cache pattern config file for the validator looks like this:
{
"patterns": [
{
"name" : "Main document",
"path" : "/",
"requiredHeaders": ["cache-control", "x-cache"],
"requiredValues" : {
"cache-control": {
"maxAge": "1800"
},
"x-cache" : "Hit from cloudfront"
}
},
{
"name" : "API's",
"path" : "/api",
"requiredHeaders": ["cache-control"],
"requiredValues" : {
}
},
{
"name" : "Static assets",
"path" : "/static",
"requiredHeaders": ["cache-control", "x-cache"],
"requiredValues" : {
"cache-control": {
"maxAge": "31536000"
},
"x-cache" : "Hit from cloudfront"
}
},
{
"name" : "Content",
"path" : "/content",
"requiredHeaders": ["cache-control", "x-cache"],
"requiredValues" : {
"cache-control": {
"maxAge": "3600"
},
"x-cache" : "Hit from cloudfront"
}
}
]
}