| 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
squirrel.toml
Enable / Disable
Disable this rule
squirrel.toml
Disable all Performance rules
squirrel.toml
Enable only this rule
squirrel.toml