Reputation: 450
I am developing an application in electronJS to run in Linux environment. It was working on old version of SLES15 SP4. When I upgraded the OS to SELES 15 SP5. I can see electron code is not able to call RES endpoint.
Description about issue:
Electron code is making REST call to endpoint http://localhost:8080/v1/myapp.
It seems localhost is mapped to ::1 ipv6 IP. Which is causing issue.
Error log snippet: Error: connect ECONNREFUSED ::1:8082
content of /etc/hosts file:
# cat /etc/hosts
127.0.0.1 localhost
::1 localhost ipv6-localhost ipv6-loopback
Now My question is why localhost is mapping to ::1 and not to 127.0.0.1. while the same code was working fine in old version OS with same content in /etc/hosts file.
NOTE: If you will comment line ::1 localhost ipv6-localhost ipv6-loopback in /etc/hosts file it will start working. But my requirement is to make it work with same content in /etc/hosts file.
Upvotes: 0
Views: 1942
Reputation: 198
The default is to resolve "names" to their IPv6 address, instead of IPv4 addresses. I'm sure this is the default since a while already.
The way how the glibc resolver works can be controlled via /etc/gai.conf, see the gai.conf(5)
man page for details.
Upvotes: 1