Skip to content

Improve Headers For Browser Caching - #283

Merged
thehabes merged 8 commits into
mainfrom
323-gog-cache
Jul 30, 2026
Merged

Improve Headers For Browser Caching#283
thehabes merged 8 commits into
mainfrom
323-gog-cache

Conversation

@thehabes

@thehabes thehabes commented Jul 28, 2026

Copy link
Copy Markdown
Member

Supports CenterForDigitalHumanities/glossing-entries#323.

Problem

GET /gog/id/:_id returns an entity with its targeting Annotations merged in, but sets Last-Modified from match — the raw document from findOne, captured before expand() runs:

let match = await db.findOne({ ... })          // line 433
...
res.set(utils.configureLastModifiedHeader(match))   // line 441
res.set("Current-Overwritten-Version", ...)
let expanded = await expand(match)             // line 446

configureLastModifiedHeader (utils.js:222-241) derives the date from __rerum.isOverwritten or __rerum.createdAt. Both describe the root entity only. The merged Annotations are never in scope for that header.

The result is a header that does not move when a targeting Annotation is added, changed, or removed — a wrong freshness signal for the composed body. Confirmed empirically: adding an Annotation changed the body and the ETag, and left Last-Modified untouched.

Related

Pairs with CenterForDigitalHumanities/glossing-entries#324, which stops the GoG client reading form-prefill data through the browser cache. Neither PR depends on the other; this one removes a latent trap for future clients and intermediaries.

@thehabes
thehabes marked this pull request as ready for review July 28, 2026 17:55
@thehabes
thehabes requested a review from cubap as a code owner July 28, 2026 17:55
@thehabes thehabes changed the title No 'Last Modified' header for /gog/id/ Remove 'Last Modified' header for /gog/id/ Jul 28, 2026
@thehabes thehabes changed the title Remove 'Last Modified' header for /gog/id/ Remove 'Last Modified' header for /gog/id/ and improve HEAD requests Jul 30, 2026
@thehabes thehabes changed the title Remove 'Last Modified' header for /gog/id/ and improve HEAD requests Improve Headers For Browser Caching Jul 30, 2026
@thehabes
thehabes merged commit 00b0d16 into main Jul 30, 2026
3 checks passed
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.

1 participant