Performance: HTTP caching headers
HIGH IMPACT
This affects how fast browsers load resources by controlling if and when cached files are reused instead of downloaded again.
app.use(express.static('public', { maxAge: '1d', etag: true }))
app.use(express.static('public')) // no cache headers set
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No caching headers | N/A | N/A | High network delay delays paint | [X] Bad |
| Cache-Control with max-age | N/A | N/A | Reduced network delay speeds paint | [OK] Good |
| No-cache forcing revalidation | N/A | N/A | Extra network round-trips delay paint | [!] OK |
| ETag with stable value | N/A | N/A | Efficient validation reduces load time | [OK] Good |