Skip to content

http.request option "family: 6" doesn't enable request over IPv6 #6440

Closed
@DimitryDushkin

Description

  • Version: 5.5
  • Platform: Ubuntu 14.04.1
  • Subsystem: http(s)

Seems like family option does nothing with actual DNS resolve to ipv6.
Problem is internal server should only use ipv6. So, instead of

https.get({
    hostname: 'cloud-api.yandex.net',
    path: '/v1/disk/resources?path=/',
    family: 6,
    port: 443,
    protocol: 'https:'
}, (res) => {
    console.log(res);
}).on('error', (e) => {
  console.log(`Got error: ${e.message}`);    // Got error: connect EHOSTUNREACH 213.180.204.127:443
});

i should write

dns.lookup('cloud-api.yandex.net', { family: 6 }, (err, addr, family) => {
    https.get({
        hostname: addr,
        path: '/v1/disk/resources?path=/',
        port: 443,
        protocol: 'https:',
        headers: { host: 'cloud-api.yandex.net' }
    }, (res) => {
        console.log(res);
    }).on('error', (e) => {
      console.log(`Got error: ${e.message}`);
    });
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.httpsIssues or PRs related to the https subsystem.tlsIssues and PRs related to the tls subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions