Repository navigation
fix(apple): Gateway connections fail behind hostname-routed HTTPS proxies - #143648
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe shared Apple Gateway URL builder omits default WSS port 443 while preserving endpoint data and other ports. Example: QR setup supplies wss://gateway.example:443 behind a hostname-matched HTTPS proxy.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a focused fix for hostname-routed HTTPS proxies that current main still needs; no actionable defects were found, and exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherApple setup and connection controllers convert parsed Gateway endpoints into URLs consumed by the existing URLSession WebSocket transport. flowchart LR
A[QR or manual setup] --> B[Gateway deep link parser]
B --> C[Gateway endpoint URL builder]
C --> D[Existing URLSession transport]
D --> E[HTTPS reverse proxy]
E --> F[Gateway WebSocket]
Technical reviewBest possible solution: Land this shared URL-builder fix after the current head's required checks complete successfully. Do we have a high-confidence way to reproduce the issue? Current-main source emits explicit WSS port 443, and the supplied native comparison identifies the resulting Host-header routing failure; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is the smallest complete fix: normalize the generated URL in its existing shared owner while retaining endpoint identity, cleartext ports, encoded paths, and transport security. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2ab944733f70. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests +26. Total +27 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (7 earlier review cycles)
Reviewed October 30, 2026, 1:37 AM ET / 05:37 UTC (Revision 8). |
|
@clawsweeper re-review Updated to f9b0a37. The custom transport and fingerprint-probe replacement are removed. Live native proof identified explicit default-port HTTP Host formatting as the cause; the PR now contains only WSS port443 URL normalization and focused tests. Explicit cleartext WS ports remain unchanged, including port80, to preserve the existing macOS canonicalization contract. The body includes before/after native evidence, successful physical-device QR onboarding and relaunch reconnect, 73 passing focused tests, and fresh clean P0/P1 autoreview with macOS consumer context. CI is running on the latest head; prior-head native-i18n, security-fast, and macOS Node lanes passed. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
I’m investigating a test-only cleanup that would consolidate the duplicated iOS The plan preserves every distinct assertion and all of this PR’s default-port regressions. It does not change Because both changes touch the shared suite, would you prefer that consolidation wait for this PR’s disposition, or is appending the missing cases independently an acceptable boundary? No parallel source edit has been started. |
|
Thanks for checking! My preference is to get this fix merged first, then follow with the consolidation. Appending missing cases independently in a separate PR is fine, provided the existing assertions and default-port regressions remain intact. Please defer moving/removing tests and the iOS source-linking changes until this lands, so we can keep this PR focused and wrap it up. |
|
Merged via squash.
|
…xies (openclaw#143648) * fix(ios): send gateway websocket SNI * fix(ios): normalize default ports for gateway proxy routing * fix(ios): preserve explicit cleartext gateway ports * test(macos): expect default TLS port normalization for setup links
…xies (#143648) * fix(ios): send gateway websocket SNI * fix(ios): normalize default ports for gateway proxy routing * fix(ios): preserve explicit cleartext gateway ports * test(macos): expect default TLS port normalization for setup links (cherry picked from commit b4047ed) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes an issue where iOS users adding a Gateway through a QR setup code would fail to connect when an HTTPS reverse proxy routes requests using an exact hostname match. The same endpoint worked through a dedicated proxy port.
Why This Change Was Made
Gateway WebSocket URLs now omit port 443 for WSS, preventing URLSession from adding an explicit default port to the HTTP Host header. Stored endpoint ports, Gateway identity, cleartext WS ports (including explicit port 80), non-default TLS ports, encoded context paths, and TLS pinning are unchanged. Cleartext ports remain explicit because existing macOS URL canonicalization treats an omitted WS port as 18789.
This replaces the original SNI diagnosis and custom Network.framework WebSocket transport. Live investigation established that HTTP Host matching, not missing SNI, caused this deployment's routing failure. The original URLSession transport and fingerprint probe are restored, retaining their existing authority checks, authentication, cookie, redirect, and WebSocket behavior; the reviewed transport regressions are removed rather than reimplemented.
User Impact
Users can onboard and reconnect to Gateway endpoints behind hostname-matched HTTPS proxies without requiring a separate frontend port or another TLS setting.
Evidence
Physical iPhone on iOS 26.6.1: the author tested the revised local app and confirmed QR onboarding and reconnect after relaunch, against the existing proxy configuration.
Native before/after proof on macOS and an iOS 26.5 simulator, using the original URLSession pinning session against the same live endpoint (hostname redacted):
wss://gateway.example:443/The diagnostic sent no Gateway authentication payload and did not log server message contents.
Independent IPv4 curl matrix:
Host: gateway.examplereturned HTTP 200 with or without DNS-name SNI;Host: gateway.example:443returned HTTP 404 with or without DNS-name SNI. Certificate verification was disabled only for the unauthenticated IP-URL/no-SNI diagnostic cases.Regression tests demonstrated default-port failures against the original URL builder. After the fix, 73 tests across
DeepLinksSecurityTests,GatewayTLSPinningTests, andGatewayCustomHeadersTestspassed, including default/non-default ports, IPv6, retained endpoint ports, and encoded paths.pnpm native:i18n:verify: passed, with no inventory changes needed after removing the custom transport.git diff --check: passed.Repository
check:changedfor the two-file candidate passed, including app SwiftLint, macOS tooling/process suites, and native schema guards; focused Swift suites and production SwiftLint were rerun after retaining explicit cleartext port 80.Follow-up macOS CI repair updates the primary Gateway replacement test to distinguish a default-port setup link from a profile's supplied explicit port, retaining all credential retirement assertions. Changed-file checks and fresh isolated autoreview, including secret scanning, passed with no P0/P1 findings.
Required
openclaw/ci-gatepassed on 7dec4a7, including successfulmacos-swift (tests),ios-build (smoke), andandroid-test-third-partychecks (CI run). The earlier macOS URL assertions are repaired. The earlier Android failure did not reproduce: its exact test and all eight tests inSettingsScreensContrastTestpassed locally, and fresh CI passed without Android changes.The native diagnostic proves handshake and reconnect, not a full authenticated app session; physical-device onboarding and relaunch reconnect were separately confirmed by the author. Earlier custom-transport test counts and build evidence have been superseded by this narrower implementation.
Maintainer review — November 27
Reviewed the unchanged published head
e3cee63d635abb4fd804d4a7ba6c2b762f4f6921before the follow-up test consolidation. The production change only omits the serialized WSS default port; endpoint storage, identity, explicit WS ports, TLS pins, credentials, and encoded path bytes retain their existing owners. The current mainline DeepLinks source and shared test suite match the PR fork base byte-for-byte. Current iOS and macOS consumers were also inspected.The exact-head CI run succeeded on October 30, including iOS screenshots, Android lanes, native i18n, and the required CI gate. This is retained evidence, not a new runtime test. The device/proxy and 73-test results above remain attributed to their original author and revisions.
Local ClawSweeper completed the three-file, five-commit range from
3cd0dd6380a1a1586c6db4574b6fc231eb3367dfto the published head with no findings. An independent source review likewise found no change to the security boundaries. No fork code or tests were executed on the operator host.