[Networking] Preserve guest HTTP requests through browser proxies - #1057
Draft
brandonpayton wants to merge 1 commit into
Draft
[Networking] Preserve guest HTTP requests through browser proxies#1057brandonpayton wants to merge 1 commit into
brandonpayton wants to merge 1 commit into
Conversation
Contributor
Phase B-1 matrix build status —
|
| Package | Arch | Status | Sha |
|---|---|---|---|
| kandelo-sdk | wasm32 | built | 5eb17e76 |
| rootfs | wasm32 | built | 9035da2c |
| shell | wasm32 | built | 7a4f452e |
| lamp | wasm32 | built | 8b5bb8eb |
| node-vfs | wasm32 | built | 305c5959 |
| wordpress | wasm32 | built | 7ea1941d |
Auto-generated; replaced on each push. Raw data in the publish-status workflow artifact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Browser guests need to make ordinary HTTP requests through a CORS proxy because a browser cannot open raw external TCP sockets. The previous paths did not share one request contract: the live shell did not configure the worker-side proxy directly, the development relay handled only GET, and the simpler fetch backend tried a direct browser fetch before using its proxy. In practice, a POST could lose its body or headers, and browser-default fetch behavior was not explicit about page credentials.
This blocks package registries and Git smart HTTP, but the fix belongs to the browser networking layer rather than to any one package manager.
What changes
credentials: "omit"with no referrer.Authorizationheader enables only authorization forwarding; a guest cannot ask the proxy to forward cookies or proxy credentials.BrowserKernelfrom one environment-aware selector. Development uses the same-origin Vite relay, production keeps the configurable public default, andVITE_CORS_PROXY_URLremains the deployment override.The request path is now:
guest HTTP client -> browser network backend -> configured CORS proxy -> target serverThe service worker passes a request that already targets the configured proxy through unchanged, so it does not discard the method, body, or headers.
Validation
cd host && npx vitest run test/cors-proxy.test.ts test/dev-cors-proxy.test.ts test/fetch-backend.test.ts test/browser-kernel.test.ts— 64 tests passed.npm --prefix host run build— ESM, CJS, and declarations built successfully (with the repository's existing CJSimport.metawarnings).apps/browser-demos/vite.config.tswithtsx— passed.cd apps/browser-demos && KANDELO_PLAYWRIGHT_PORT=5417 npx playwright test test/browser-cors-proxy.spec.ts --project=chromium— 2 tests passed. This runs real guest GNU Wget GET and authenticated POST requests and verifies the exact body/headers plus cookie/referrer isolation.The full host Vitest suite was also attempted in this sparse worktree: 1,573 tests passed, while 30 tests outside this change failed because their wasm64 sysroot, binary fixtures, repo-root JS dependency, or current generated PTY fixtures were unavailable or stale here. The focused networking tests above are clean.