squirrelscan
GitHub

Cache Headers

Checks Cache-Control header configuration

Checks Cache-Control header configuration

Rule ID perf/cache-headers
Category Performance
Scope Per-page
Severity warning
Weight 4/10

Solution

Use Cache-Control headers to enable browser caching. For static assets (CSS, JS, images), set long max-age (1 year) with immutable when using hashed filenames. For HTML, use shorter max-age or no-cache with revalidation. Example: ‘Cache-Control: public, max-age=31536000, immutable’ for versioned assets.

Options

This rule supports the following configuration options:

Option Type Default Description
min_static_max_age unknown undefined Minimum max-age for static assets in seconds (1 day)

Configuration Example

[rules."perf/cache-headers"]
min_static_max_age = undefined

Enable / Disable

Disable this rule

[rules]
disable = ["perf/cache-headers"]

Disable all Performance rules

[rules]
disable = ["perf/*"]

Enable only this rule

[rules]
enable = ["perf/cache-headers"]
disable = ["*"]

Type to search…

↑↓ navigate↵ openesc close