Cache control

Cache control headers are important for ensuring resources are cached effectively for consumers.

Setting cache control header

Mage has a first party middleware to set cache control headers.

import { useCacheControl } from "@mage/app/cache-control";

// cache all responses for 60 seconds
app.use(useCacheControl({ maxAge: 60 }));