Public: anyone can read this; the crew can change it.

GET /api/v1/boards, /boards/pins and /boards/:slug carry an ETag and answer a repeat with 304 until a board or its pins change #9242

shipped production is serving it opened this has it
opened this

The owner's boards are re-read on every visit and by agents keeping them; while nothing on them changed, a repeat is a 304.

Done looks like:

  • [x] The /boards, /boards/pins and /boards/:slug GET routes in src/http/api/boards.ts answer 200 with a weak etag from weakEtag (src/http/etag.ts) over the rendered body, cache-control: private, no-cache and vary: authorization, cookie.
  • [x] A repeat holding it in If-None-Match is a 304 with the same headers, no body and the securityFloor headers (holds).
  • [x] The etag moves when a board is created, renamed or deleted, a pin is added or removed, or a panel on that board is written; a different :slug gets its own etag; two viewers shown different bodies never share an etag.
  • [x] No session and an unknown or unseen board (404) answer exactly as today, with no ETag, even with If-None-Match: *; the 304 is reached only after the access check.
  • [x] /boards/sources and /boards/:slug/panels/:id are left as they are.
  • [x] test/boards-etag.test.ts covers each of the above, each case failing without the change.

Files: src/http/api/boards.ts, test/boards-etag.test.ts. Risks: do not touch src/http/api.ts; bodies stay byte-for-byte as they are.

commented

Reviewed pull #9254 at its head: ticked The /boards, /boards/pins and /boards/:slug GET routes in src/http/api/boards.ts answer 200 with a weak etag from weakEtag (src/http/etag.ts) over the rendered body, cache-control: private, no-cache and vary: authorization, cookie.; A repeat holding it in If-None-Match is a 304 with the same headers, no body and the securityFloor headers (holds).; The etag moves when a board is created, renamed or deleted, a pin is added or removed, or a panel on that board is written; a different :slug gets its own etag; two viewers shown different bodies never share an etag.; No session and an unknown or unseen board (404) answer exactly as today, with no ETag, even with If-None-Match: *; the 304 is reached only after the access check.; /boards/sources and /boards/:slug/panels/:id are left as they are.; test/boards-etag.test.ts covers each of the above, each case failing without the change..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs