Skip to content

Fix warming service worker scripts through preview proxy - #2310

Merged
chubes4 merged 2 commits into
mainfrom
fix/issue-2305-wp-codebox
Aug 22, 2026
Merged

Fix warming service worker scripts through preview proxy#2310
chubes4 merged 2 commits into
mainfrom
fix/issue-2305-wp-codebox

Conversation

@chubes4

@chubes4 chubes4 commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • retry up to two transient upstream redirects for actual GET service-worker registration requests before exposing a response to Chromium
  • retain normal proxy redirect behavior for all other requests and keep service-worker registration headers out of upstream requests
  • add a Chromium integration regression that registers and activates a worker through the proxy after two upstream redirects

Closes #2305

Reproduction and testing

Before this change, a preview upstream returning transient 302 responses for /sw.js causes Chromium registration to reject the script because service-worker scripts cannot be redirected.

The regression starts a real Chromium browser, loads the proxied preview, calls navigator.serviceWorker.register("/sw.js"), and verifies activation after two upstream 302 responses followed by 200. It also verifies the registration headers are not forwarded upstream.

Tests run:

  • npm run build
  • npm run test:service-worker-preview-proxy
  • npm run test:browser-callback-materialization-contracts
  • npm run test:browser-canonical-preview-origin
  • npm run test:browser-actions-environment
  • npm run check (the aggregate run reached an existing command-registry failure: wordpress.collect-workload-result outputShape should mention outputSchema id; the 120-second command limit then stopped it)

AI assistance

OpenAI gpt-5.6-sol used through OpenCode investigated the proxy and browser behavior, implemented the bounded retry and Chromium coverage, and ran the listed checks. Chris Huber reviewed and remains responsible for every line.

@chubes4
chubes4 merged commit fad8835 into main Aug 22, 2026
4 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.

Preview proxy redirects service-worker script requests

1 participant