You need to explicitly specify the zone ID in order to tell the network stack which interface to make the connection via (I don't know why macOS doesn't set a reasonable default, but... it doesn't). There's no sane way to do this (that I know of, anyway), but there is a kluge that'll get it done. First, find the numeric (hexadecimal) zone (/scope) ID of your primary network interface with ifconfig <interfacename>
. You should get something like this:
% ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
ether f8:ff:c2:b5:02:11
inet6 fe80::68:e021:8a0b:3d38%en0 prefixlen 64 secured scopeid 0x5
[...]
The thing you need here is the "scopeid" at the end, but without the "0x" prefix -- it's 5 in this example.
Add that ID number to the IPv6 address as the second 16-bit word, i.e. fe80::xxxx:xxxx:xxxx
-> fe80:5::xxxx:xxxx:xxxx
, and use that in the url, like https://[fe80:5::xxxx:xxxx:xxxx ]/
.
The reason this works is that BSD-based network stacks (like macOS') use the second word internally to represent the interface/zone ID, and you can take advantage of this to sneak a zone ID past parsers that don't allow them to be specified the normal way.
BTW, there's apparently an effort underway to officially support zone IDs in URLs, but it's not there yet. See RFC6874 (especially page 5). Note that this has been a problem for a long time, see this Firefox "bug" entry dating back 13 years!