Cache Control Input

Cache Control Input is a copy-paste React component that stops private page cached by the cdn before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/cache-control-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsPrivate page cached by the CDN

Was this component page useful?

How do I install Cache Control Input?

pnpm dlx shadcn@latest add @bollard/cache-control-input

The files land in your project. They're yours to edit.

How do I use Cache Control Input in React?

cache-control-input-usage.tsx
import { CacheControlInput } from "@/components/ui/cache-control-input"

return <CacheControlInput defaultValue={accountPage} defaultPath="/account" defaultPersonalized now={Date.UTC(2026, 9, 14)} />

What input mistakes does Cache Control Input catch?

  • Personalised pages that a CDN or shared cache may store
  • Responses that set a cookie but are marked public
  • no-cache used where no-store was meant
  • immutable on URLs without a content hash, and long max-age on HTML
  • A missing Vary for compressed or negotiated bodies; one-tap fixes for each

What props does Cache Control Input accept?

CacheControlInput props
PropTypeDefault
value

Controlled header text: full "Name: value" lines, or a bare Cache-Control value.

string—
defaultValue

Initial header text when uncontrolled.

string""
onValueChange

Called with the new text on every edit or fix.

(value: string) => void—
personalized

Controlled "different for each signed-in user" switch.

boolean—
defaultPersonalized

Initial value of that switch when uncontrolled.

booleanfalse
onPersonalizedChange

Called when the user flips the switch.

(personalized: boolean) => void—
path

Controlled URL path the headers are for. Judges fingerprinted assets and HTML pages.

string—
defaultPath

Initial URL path when uncontrolled.

string""
onPathChange

Called when the user edits the path.

(path: string) => void—
varyOn

Request headers that change the body (e.g. ["Accept-Language"]); each must be listed in Vary.

string[]—
now

Clock for Expires maths, in ms. Defaults to the time the component mounted.

number—
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{detail}`, `{source}`, `{duration}`, `{swr}`, `{from}`, `{to}`, `{count}` are filled in.

Partial<CacheControlInputMessages>—

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

How is Cache Control Input accessible?

  • Labelled textarea with aria-invalid and aria-describedby to a role="status" summary
  • Readback is a section labelled by its heading
  • After a fix, focus moves to the next fix button or back to the field
  • Severity is shown with icons and text, not colour alone

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Reads the header text you give it; real CDN behaviour also depends on its own configuration
  • Whether a page is personalised and the URL path are inputs you provide
  • Vendor-specific headers beyond CDN-Cache-Control and Surrogate-Control are not modelled

What validation rules apply to Cache Control Input?

Rules last verified:

Informational; check the official source and your CDN's documentation. Surrogate-Control handling follows vendor convention and was not checked against a standard. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Cache Control Input stop?

Private page cached by the CDN

Also known as

cache-control · http headers · cdn · cloudflare · vercel · s-maxage · max-age · immutable

Field type

What dependencies does Cache Control Input require?

Cache Control Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameCache Control Input
Registry identifier@bollard/cache-control-input
Install commandnpx shadcn@latest add @bollard/cache-control-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Cache Control Input

What form validation mistake does Cache Control Input catch?

Cache Control Input prevents private page cached by the CDN. Reads back who will store a response and for how long, so a per-user page isn't cached by the CDN and HTML isn't stuck for days. Catches: Personalised pages that a CDN or shared cache may store, Responses that set a cookie but are marked public, no-cache used where no-store was meant, immutable on URLs without a content hash, and long max-age on HTML, A missing Vary for compressed or negotiated bodies; one-tap fixes for each. Limitation: validate cache-control-input schemas on backend.

How do I install cache-control-input with shadcn?

Run `npx shadcn@latest add @bollard/cache-control-input`. Sources added: registry/default/cache-control-input/cache-control-input.tsx, registry/default/cache-control-input/cache-control.ts. Package requirements: lucide-react.

What props customize Cache Control Input?

Cache Control Input accepts `value`, `defaultValue`, `onValueChange`, `personalized`, `defaultPersonalized`. Configures cache-control, http headers, cdn behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of cache-control-input?

Reads the header text you give it; real CDN behaviour also depends on its own configuration. Whether a page is personalised and the URL path are inputs you provide. Vendor-specific headers beyond CDN-Cache-Control and Surrogate-Control are not modelled Server requirement: backend verification for cache-control-input.

How does Cache Control Input meet accessibility guidelines?

Labelled textarea with aria-invalid and aria-describedby to a role="status" summary. Readback is a section labelled by its heading. After a fix, focus moves to the next fix button or back to the field. Severity is shown with icons and text, not colour alone. Minimizes errors: cdn caching user data, no-cache vs no-store.

Which components pair with Cache Control Input?