Skip to content

Omit default ports from connection URLs - #977

Open
pataar wants to merge 1 commit into
pusher:masterfrom
pataar:fix/omit-default-ports
Open

pataar wants to merge 1 commit into
pusher:masterfrom
pataar:fix/omit-default-ports

Conversation

@pataar

@pataar pataar commented Sep 8, 2026

Copy link
Copy Markdown

PR description is generated by Claude. But the problem is a real occurring one on our React Native iOS case.

What does this PR do?

Connection URLs always include the port, e.g. wss://ws-mt1.pusher.com:443/app/.... Some WebSocket clients copy an explicit URL port verbatim into the Host header. SocketRocket (React Native on iOS) does this unconditionally (_SRHTTPConnectMessageHost), producing Host: ws-mt1.pusher.com:443. That is valid per RFC 9110 but redundant, and some firewalls and proxies reject it, so the handshake fails on iOS while browsers, which normalise default ports away, are fine.

This drops the port from the URL when it equals the scheme default (443 for TLS, 80 otherwise) in getGenericURL, the single place every transport URL (ws/wss/http/https/sockjs, all runtimes) is built. Explicitly configured non-default ports (wssPort: 1999, …) are unchanged.

Existing specs asserting the default URLs were updated to the portless form. The custom-port specs already cover the "non-default port is kept" case.

Checklist

  • All new functionality has tests.
  • All tests are passing.
  • New or changed API methods have been documented. (no API change)
  • npm run format has been run

CHANGELOG

  • [FIXED] Omit default ports (443/80) from connection URLs so WebSocket clients that copy the URL port into the Host header (e.g. SocketRocket on iOS / React Native) no longer send Host: host:443, which some firewalls and proxies reject

Connection URLs always carried the port, e.g. wss://ws-mt1.pusher.com:443.
Some WebSocket clients (SocketRocket on iOS / React Native) copy the URL
port verbatim into the Host header, and some firewalls and proxies reject
Host: ws-mt1.pusher.com:443 even though it is valid.

Leave the port out when it equals the scheme default (443 for TLS, 80
otherwise). Explicitly configured non-default ports are unchanged.

Claude-Session: https://claude.ai/code/session_016iDLS6rFN2quXXKim1T3qu
@pataar

pataar commented Sep 8, 2026

Copy link
Copy Markdown
Author

Happy to discuss any changes, or questions

@pataar
pataar marked this pull request as ready for review September 8, 2026 13:20
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.

1 participant