fix(relay): use TLS for any port-443 relay endpoint (#774)
* fix(relay): use TLS for any port-443 relay endpoint `shouldUseTlsForDefaultHostedRelay` only returned true for `relay.paseo.sh:443`. Self-hosted relays on port 443 connected via `ws://` instead of `wss://`, causing HTTP 400 from the TLS server. Port-based detection: port 443 → wss, everything else → ws. * Test port-based hosted relay TLS detection Cover the new behavior: any port-443 endpoint (hosted Paseo or self-hosted) and IPv6 hosts return true, non-443 ports and malformed input return false. --------- Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
co-authored by
Mohamed Boudra
parent
7e8187ddc7
commit
24bdd3c8ad
@@ -204,7 +204,8 @@ export function buildRelayWebSocketUrl(params: {
|
||||
*/
|
||||
export function shouldUseTlsForDefaultHostedRelay(endpoint: string): boolean {
|
||||
try {
|
||||
return normalizeHostPort(endpoint) === DEFAULT_RELAY_ENDPOINT;
|
||||
const { port } = parseHostPort(endpoint);
|
||||
return port === 443;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user