Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(server): send Cache-Control: private, no-store by default - #312

Open
ngunyimacharia wants to merge 1 commit into
razorpay:masterfrom
ngunyimacharia:ngunyimacharia/no-store-by-default
Open

ngunyimacharia wants to merge 1 commit into
razorpay:masterfrom
ngunyimacharia:ngunyimacharia/no-store-by-default

Conversation

@ngunyimacharia

Copy link
Copy Markdown

What and why

API, MCP, OAuth and app-shell responses carry no Cache-Control header, so a shared cache in front of the server (a CDN or a hosting platform's edge) may store them. They depend on who is signed in, so a stored copy can reach another caller, and a cached /v1/me keeps the app signed in after sign-out.

A middleware now marks every response private, no-store unless its handler sets its own policy, as document pages do. Fingerprinted /assets/ files keep their caching.

Closes #307

How it was tested

  • New table test covers the account endpoint (signed in and rejected), the document list and the app shell (private, no-store), a document page (keeps private, no-cache) and a fingerprinted asset (no header).
  • go test ./api/... ./cli/... ./internal/... and make lint pass.
  • Running in production behind Laravel Cloud's edge: the API now reports a cache bypass, and sign-out sticks.

Checklist

  • make lint and make test pass locally
  • Tests added or updated for the change
  • No breaking change, or the migration path is described below

API, MCP, OAuth and app-shell responses carried no Cache-Control header.
A shared cache in front of the server may then store them: Laravel
Cloud's edge, for example, caches a 200 response without Cache-Control
for two hours. These responses depend on who is signed in, so a stored
copy can reach another caller, and a cached /v1/me keeps the app signed
in after sign-out.

Mark every response "private, no-store" unless its handler sets its own
policy, as document pages do. Fingerprinted /assets/ files keep their
caching.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-user API responses carry no Cache-Control, so a caching edge or CDN can store them

1 participant