You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit deec8d4
Browse filesBrowse the repository at this point in the historyBrowse files
perf(seo): send ETags on edge cached pages and answer 304 (#636)
Edge cached HTML carried no validator, so every recrawl downloaded every
page again. The Nuxt SEO crawler saw no unchanged page in seven days, and
Workers Cache replaced each stale page with a full render.
A page under an edgeCache rule now gets a weak ETag from the build id and
a hash of its HTML. Sentry's per-render trace meta tags are left out of the
hash. A request that sends the ETag back gets an empty 304 that keeps the
route's cache headers. Requests with credentials and pages the edge may
not store get no ETag.
No page sends Last-Modified. A Skill page shows stars, ages and related
Skills, so no one date bounds it, and a cache would answer
If-Modified-Since with a wrong 304.
The post-deploy edge cache check now proves the 304, and proves that a
conditional request on a cold entry never leaves a 304 for the next visitor.
Copy file name to clipboardExpand all lines: docs/arch/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,7 @@ See [ADR-0007](../adr/0007-contract-in-the-cli-repository.md).
73
73
-**Public pages render signed out**: the server never reads the session for a public page. The server render must not branch on User-Agent either, because `Vary` does not name it. Only then can one stored copy serve every visitor. A page that calls `useBotDetection()` on the server needs that call removed before it gets an edge cache rule. The browser loads the session after hydration. `useAuth().state` is `pending`, `anonymous`, or `signed-in`, and an auth-dependent control renders a same-size placeholder while it is `pending`. A page that needs the session on the server uses the `session` or `auth` route middleware, which also marks the response `private, no-store`.
74
74
-**Session reads**: server code reads the session with `readUserSession()`. It opens a session only when the request carries one, because h3 sets a new session cookie on every other read. ESLint bans a direct `getUserSession()`.
75
75
-**Markdown negotiation**: `shared/content-negotiation.ts` decides HTML or a 307 to the `.md` URL from `Accept` and `Sec-Fetch-Dest` only, and every page response names both in `Vary`.
76
+
-**HTML validators**: `shared/html-validators.ts` gives a page under an `edgeCache` rule a weak ETag: the build id plus a hash of the HTML. A request that sends it back gets an empty 304. A request with a cookie or an `Authorization` header gets no ETag. No page sends `Last-Modified`, because no one date bounds what a page renders.
0 commit comments