magefree / magefree/mage

Local server can use wrong address in multiple networks environment and localhost connect

Open
#12,537 0 comments 1 reaction 1 assignee Claimed by @JayDi85 View on GitHub
bug server
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

Server must return own address on client connection. If it connected by localhost then server will search first available network interface (non-loopback) to find real address. It can fail and return wrong interface/ip without started listener (socket listener on the port). So client can’t connect to it.

TODO:
* research and reproduce use case (multiple network interfaces: local + virtual, first interface must be unavailable for socket listening; serverAddress as 0.0.0.0, connect by localhost);
* fix the problem. Possible solution: find really running listeners and return from that list, not from first available network.

Workaround for users:
* open launcher-folder/mage/mage-server/config/config.xml in text editor and change serverAddress from 0.0.0.0 to 127.0.0.1
* restart server app and connect to it by address 127.0.0.1 instead localhost

And restart server app.

Related code:
![IMG_0567](https://github.com/magefree/mage/assets/8344157/6584ae06-8159-47de-9d02-950539bde9f1)
![IMG_0566](https://github.com/magefree/mage/assets/8344157/ed4d98de-f3d4-42d5-aa67-a91904c2a741)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.