Force IPv4 for CARD API requests
card.charter.com resolves to both IPv4 (47.43.51.7) and IPv6 (2600:6c7f:9340:ca5::7). IPv6 is unreachable from this network, causing Node.js to attempt IPv6 first, wait for timeout, then fall back — but the 15s request timeout fires before the fallback completes. Adding family: 4 to both acquireToken and doRequest forces IPv4 resolution, matching curl behavior.
This commit is contained in:
@@ -57,6 +57,7 @@ function acquireToken(timeout) {
|
||||
port: fullUrl.port || (isHttps ? 443 : 80),
|
||||
path: fullUrl.pathname + fullUrl.search,
|
||||
method: 'POST',
|
||||
family: 4, // Force IPv4 — IPv6 is unreachable from this network
|
||||
headers: {
|
||||
'accept': 'application/json',
|
||||
'authorization': 'Basic ' + authString,
|
||||
@@ -150,6 +151,7 @@ async function cardRequest(method, urlPath, body, options) {
|
||||
port: fullUrl.port || (isHttps ? 443 : 80),
|
||||
path: fullUrl.pathname + fullUrl.search,
|
||||
method,
|
||||
family: 4, // Force IPv4 — IPv6 is unreachable from this network
|
||||
headers,
|
||||
timeout,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user