Commit 45c7ed1
committed
Document why the CWA API must not be SW-cached (#258)
Investigation for #258. The issue proposed SWR runtime caching of the CWA
endpoints "with auth/draft responses excluded". Verified against source, that
exclusion is not implementable:
- Draft and published responses share an identical URL — the primary fetch
requests /_/routes/{path} and /_/resource_manifest/{path} with no
?published= marker; the API picks draft-vs-published from the auth cookie.
- The API sends no Vary: Cookie, so the Cache API cannot partition anon from
authed entries.
- Every request is credentials: 'include' and cross-origin to apiUrlBrowser —
a readable 200 that Workbox caches happily (it ignores Cache-Control:
no-store).
- Workbox urlPattern match callbacks are synchronous, so they cannot read auth
state (no document.cookie in a SW; cookieStore is async + Chromium-only).
So an admin's cached draft could be replayed to the next anonymous visitor on
the same device, and a URL denylist cannot fix it — there is no distinguishing
URL. Recommendation inverts to app-shell-only + page-side IndexedDB (#257/#259),
where auth state is readable.
Comments only — no behaviour change. The playground config was already correct
(vite-pwa is a playground devDependency, navigateFallback: null, no
runtimeCaching); this records the rule so API caching is not added later.1 parent 60ffec1 commit 45c7ed1
2 files changed
Lines changed: 48 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
417 | | - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
418 | 437 | | |
419 | 438 | | |
420 | 439 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
131 | 134 | | |
132 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
| |||
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
158 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
159 | 186 | | |
160 | 187 | | |
161 | 188 | | |
| |||
0 commit comments