fix: use correct default port for wss:// in NO_PROXY matching

The proxy bypass logic assigned port 80 to any non-https protocol,
including wss:// whose default port is 443. A NO_PROXY entry like
example.com:443 would not match wss://example.com because the port
was incorrectly resolved to 80.

Relates to #40

Co-Authored-By: Juan Camilo <juancamilo.auriti@gmail.com>
This commit is contained in:
Juan Camilo
2026-04-01 17:05:45 +02:00
parent 8750f84464
commit 409e90c510

View File

@@ -97,7 +97,9 @@ export function shouldBypassProxy(
try { try {
const url = new URL(urlString) const url = new URL(urlString)
const hostname = url.hostname.toLowerCase() const hostname = url.hostname.toLowerCase()
const port = url.port || (url.protocol === 'https:' ? '443' : '80') const port = url.port || (
url.protocol === 'https:' || url.protocol === 'wss:' ? '443' : '80'
)
const hostWithPort = `${hostname}:${port}` const hostWithPort = `${hostname}:${port}`
// Split by comma or space and trim each entry // Split by comma or space and trim each entry