[personal-wp] Skip CORS proxy for localhost requests#3199
Conversation
e6877d3 to
a0fbf24
Compare
a0fbf24 to
de08482
Compare
| * Never proxy localhost requests to known local API ports. The remote proxy | ||
| * cannot reach the user's localhost, so we must fetch directly. | ||
| * | ||
| * Known ports: |
There was a problem hiding this comment.
Limiting the ports seems weird, proxying localhost makes no sense on any port. Should we guard this based on host only?
There was a problem hiding this comment.
Thanks! I started off on that path but then got discouraged by CI failures where tcp-over-fetch-websocket tests rely on http being upgraded https upgrade. The server is HTTPS but the code constructs http:// URLs. I interpret this an an oversight and updated the websocket tests.
ab5c486 to
70f1258
Compare
Localhost requests now bypass the CORS proxy and are fetched directly. This enables access to local APIs since the remote proxy cannot reach the user's localhost.
5d16249 to
61b034e
Compare
|
Ok this now snow-balled into having to implement two TLS extensions ( |
61b034e to
ea6b246
Compare
…extension - HTTP path tests now use an HTTP server (matching real localhost usage) - Added TLS path test with proper TLS handshake - Added renegotiation_info extension support for Node.js TLS compatibility
ea6b246 to
92480f7
Compare
packages/php-wasm/web/src/lib/tls/extensions/65281_renegotiation_info.ts
Show resolved
Hide resolved
packages/php-wasm/web/src/lib/tls/extensions/65281_renegotiation_info.ts
Show resolved
Hide resolved
|
Comments added, ready to merge? |
Motivation for the change, related issues
Enable access to local APIs from WordPress Playground. Previously, localhost requests would be upgraded to HTTPS and could fall through to the CORS proxy retry logic, which would fail since the remote proxy cannot reach the user's localhost.
Implementation details
fetchWithCorsProxyand return direct fetch immediatelytcp-over-fetch-websocket.tsto construct HTTPS URLs (was incorrectly relying on the HTTP→HTTPS upgrade)Testing Instructions (or ideally a Blueprint)
http://localhost:11434/api/...