Skip to Content
Senri

Cache

Add Cache-Control and Vary with cache()

import { ,  } from "@senrijs/senri";

const  = ();

.("/assets", ({ : "public, max-age=3600" }));
  • It adds Cache-Control and Vary to 2xx and 304 responses to GET and HEAD
  • It does not store anything. Storing is left to browsers and CDNs
  • Register it before etag()

Do not mark personal pages public

Cookies set with setCookie() are not visible to middleware. If you add public to a path with pages for logged-in users, a CDN might serve one person's page to someone else.

Options

Prop

Type

On this page