fix(hosting): live probe가 redirect된 워커 스크립트를 거절한다
문제 워커를 싣는 빌드에서 live probe는 `/service-worker.js`를 기본 fetcher `redirect: "follow"`로 받고, 최종 응답의 status와 origin만 본다 (`scripts/lib/hosting-probe.ts` `probeLiveRelease`). 같은 origin 안 redirect 뒤에 200·`no-cache`·JS MIME이 오면 FE-GATE-019가 PASS다. 브라우저는 워커 스크립트를 redirect mode "error"로 받는다(Service Worker Update 알고리즘). 그런 호스트에서는 첫 등록, update 검사, `REMOVE_REGISTRATION` kill switch가 모두 실패한다. 고른 방법과 버린 대안 - `serviceWorker` surface에만 `redirect` 행을 더한다. `response.redirected`이거나 `opaqueredirect`이면 FAIL이다. 자산 probe(1105/06-02)와 같은 판정식이라 fetcher가 redirect를 따라가든 manual이든 잡는다. 3xx 응답은 지금처럼 `http-status` 행이 FAIL로 본다. - redirect가 없으면 이 행은 PASS로 남는다. 산출물에 이 검사를 했다는 기록이 된다. - 버린 대안: 모든 surface에서 redirect를 FAIL로 보기(리뷰 (b)). `index`·`appRoute`의 정상 redirect(끝 슬래시 정규화 등)까지 막는다. 문서에만 적기(리뷰 (c))는 게이트가 그대로 PASS다. - 운영 문서 두 곳에 "redirect 없이"를 적었다. release-cache-rollback.md의 live probe 설명과 browser-file-storage-recovery.md의 kill switch 전제다. 위험·한계 - 워커 스크립트를 redirect하던 호스트는 이제 FE-GATE-019에서 FAIL이다. 그런 호스트에서는 지금도 워커가 동작하지 않는다. - 브라우저 거절은 명세와 Chromium 오류 문구에 기댄 것이다. redirect하는 호스트로 실제 등록을 돌려 보지 않았고, live 모드도 실제 호스트로 돌리지 않았다(리뷰 §5 미검증 그대로). 검증 - desktop batch에서 확인: node scripts/run-vitest.ts run tests/unit/hosting-probe.test.ts - RED: "live hosting probe (1105/06-02) > fails a worker script the host answers only after a same-origin redirect"가 실패한다. 옛 probe에는 redirect 행이 없어 실패 행이 비어 있다. - 함께: check:types, lint, verify:documentation Refs: 1106/06-01
This commit is contained in:
@@ -611,10 +611,11 @@ Service Worker를 별도 선택한 조합에서만 추가. 워커의 fetch 가
|
||||
`skipWaiting()`하고, 활성화 때 `registration.unregister()`한다. fetch handler가
|
||||
없어서 그동안의 요청은 모두 네트워크로 간다. 다음 load부터는 제어받지 않는다.
|
||||
브라우저 확인: `tests/e2e/service-worker-recovery.spec.ts`.
|
||||
- 이 경로가 동작하려면 `service-worker.js`를 `Cache-Control: no-cache`로 서빙해야
|
||||
한다. 워커를 싣는 빌드(`ACTIVE`·`REMOVE_REGISTRATION`)에서는
|
||||
`verify:hosting-headers` live 모드가 `/service-worker.js`를 요청해 이 헤더를
|
||||
확인하고, 다르면 FAIL이다(`config/hosting/cache-policy.json` `serviceWorker`,
|
||||
- 이 경로가 동작하려면 `service-worker.js`를 `Cache-Control: no-cache`로, redirect
|
||||
없이 서빙해야 한다. 브라우저는 워커 스크립트의 redirect를 같은 origin 안이라도
|
||||
거절한다. 워커를 싣는 빌드(`ACTIVE`·`REMOVE_REGISTRATION`)에서는
|
||||
`verify:hosting-headers` live 모드가 `/service-worker.js`를 요청해 이 헤더와
|
||||
redirect를 확인하고, 다르면 FAIL이다(`config/hosting/cache-policy.json` `serviceWorker`,
|
||||
`scripts/verify-hosting-headers.ts`). fixture 모드는 선언끼리만 대조하므로
|
||||
`UNVERIFIED`다. 하위 경로 base URL은 live probe가 아직 받지 않는다
|
||||
(`scripts/lib/hosting-probe.ts` `classifyLiveHostingBaseUrl`, 리뷰 0929/13-06).
|
||||
|
||||
@@ -71,9 +71,12 @@ It also requests `appRoute` (`/__probe/deep-link`, a path no build has a file
|
||||
for): the host must answer 200 with the same `index.html` (the same entry
|
||||
script) and the HTML headers, so a host without the SPA fallback fails
|
||||
(review 1101/13-04). When the build ships a worker it requests
|
||||
`/service-worker.js` and expects `no-cache`. The surfaces and their headers are
|
||||
declared in `config/hosting/cache-policy.json`. For each cacheable extension the
|
||||
release has under `assets/` (`.css`, `.js`, `.woff2` and the rest of
|
||||
`/service-worker.js` and expects `no-cache` and no redirect at all, not even
|
||||
one inside the origin: browsers fetch the worker script with redirect mode
|
||||
`error`, so registration, every update check and the `REMOVE_REGISTRATION`
|
||||
kill switch fail behind one (review 1106/06-01). The surfaces and their
|
||||
headers are declared in `config/hosting/cache-policy.json`. For each cacheable
|
||||
extension the release has under `assets/` (`.css`, `.js`, `.woff2` and the rest of
|
||||
`CACHEABLE_ASSET_CONTENT_TYPES`) it requests the first such file and expects
|
||||
exactly that type (`hashedAsset.css` and so on). The worker's install refuses
|
||||
the whole release when one precached asset has another type, while a page
|
||||
|
||||
Reference in New Issue
Block a user