Socket
Book a DemoInstallSign in
Socket

@superherocheesecake/cache-validator

Package Overview
Dependencies
Maintainers
26
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@superherocheesecake/cache-validator

Validates cache settings against Superhero Cheesecake standards

latest
npmnpm
Version
1.0.2
Version published
Maintainers
26
Created
Source

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"                
            }
        }   
    ] 
}

FAQs

Package last updated on 12 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.