Skip to content

Unusable IPv6 address printed #4630

@codefrau

Description

@codefrau

Bug report

The network IPv6 address printed on my machine is http://[fe80::1]:9684/ but that works neither on the same host nor over the network.

Actual Behavior

This is what is printed on startup:

<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:9684/
<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.0.114:9684/
<i> [webpack-dev-server] On Your Network (IPv6): http://[fe80::1]:9684/

Opening a browser for http://[fe80::1]:9684/ is not working.

That's because fe80:... is a link local address that is not complete without specifying an interface:

> ifconfig | grep fe80::1
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 

but [fe80::1%lo0] is not valid in URLs, and would not work from other machines on the same network anyways.

Expected Behavior

This is what should be printed on my machine:

<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:9684/
<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.0.114:9684/
<i> [webpack-dev-server] On Your Network (IPv6): http://[fdf3:d6d6:1552:47c0:1cbc:d6a:fbe1:7201]:9684/

The last URL (http://[fdf3:d6d6:1552:47c0:1cbc:d6a:fbe1:7201]:9684/) actually works on my local machine, as well as from other machines.

That's because fdf3:... is a "unique local address".

How Do We Reproduce?

On macOS Monterey 12.5.1 and a Mac with wifi run

webpack-dev-server

For context, here's the listing for my wifi interface:

> node -p 'require("os").networkInterfaces()["en0"]'
[
{
    address: 'fe80::104f:825:d43f:9036',
    netmask: 'ffff:ffff:ffff:ffff::',
    family: 'IPv6',
    mac: 'f0:2f:4b:00:eb:9c',
    internal: false,
    cidr: 'fe80::104f:825:d43f:9036/64',
    scopeid: 14
},
{
    address: '192.168.0.114',
    netmask: '255.255.255.0',
    family: 'IPv4',
    mac: 'f0:2f:4b:00:eb:9c',
    internal: false,
    cidr: '192.168.0.114/24'
},
{
    address: 'fdf3:d6d6:1552:47c0:1cbc:d6a:fbe1:7201',
    netmask: 'ffff:ffff:ffff:ffff::',
    family: 'IPv6',
    mac: 'f0:2f:4b:00:eb:9c',
    internal: false,
    cidr: 'fdf3:d6d6:1552:47c0:1cbc:d6a:fbe1:7201/64',
    scopeid: 0
}
]

The simplest fix for my machine would be excluding link-local addresses:

> node -p 'Object.values(require("os").networkInterfaces()).flat().map(each => each.address).filter(addr => !/^fe[89ab]/.test(addr))'
[
'127.0.0.1',
'::1',
'192.168.0.114',
'fdf3:d6d6:1552:47c0:1cbc:d6a:fbe1:7201'
]

Please paste the results of npx webpack-cli info here, and mention other relevant information

System:
  OS: macOS 12.5.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 4.62 GB / 64.00 GB
Binaries:
  Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
  Yarn: 1.22.18 - ~/.nvm/versions/node/v16.14.2/bin/yarn
  npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
Browsers:
  Chrome: 107.0.5304.87
  Firefox: 105.0.3
  Safari: 15.6.1
  Safari Technology Preview: 16.0
Packages:
  copy-webpack-plugin: ^11.0.0 => 11.0.0 
  html-webpack-plugin: ^5.5.0 => 5.5.0 
  source-map-loader: ^4.0.0 => 4.0.1 
  terser-webpack-plugin: ^5.3.3 => 5.3.6 
  webpack: ^5.74.0 => 5.74.0 
  webpack-cli: ^4.10.0 => 4.10.0 
  webpack-dev-server: ^4.11.1 => 4.11.1 

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions