Skip to main content
Checks Cache-Control header configuration
Rule IDperf/cache-headers
CategoryPerformance
ScopePer-page
Severitywarning
Weight4/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:
OptionTypeDefaultDescription
min_static_max_ageunknownundefinedMinimum max-age for static assets in seconds (1 day)

Configuration Example

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

Enable / Disable

Disable this rule

squirrel.toml
[rules]
disable = ["perf/cache-headers"]

Disable all Performance rules

squirrel.toml
[rules]
disable = ["perf/*"]

Enable only this rule

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