auth-session.ts
13 KB
-
优化匿名冷启动与公开内容接口的重复回源请求 (#7166) · 219c9e06
* fix: reduce public bootstrap requests and revalidate content * fix(controller): use a weak ETag for revalidated public JSON /api is gzip-compressed by middleware that runs after the handler returns, and the validator is computed over the uncompressed body. The compressed and identity forms of one payload therefore share a validator, which a strong ETag must not do -- it asserts byte-for-byte equality across representations (RFC 9110 8.8.1). Serve W/ instead. Weak comparison ignores W/ on both operands, so etagMatches now strips it from the served validator as well as from each candidate. Stripping only the candidate would make a weak served validator match nothing and silently disable every 304. Vary: Accept-Encoding stays. Weakening the validator makes revalidation correct, but it does not separate the two encodings in a shared cache. * fix(test): align response cookie helper name * fix(auth): revalidate stale route sessions * Update web/src/features/about/api.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * test: remove newly added PR tests --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Orrin committed