I've been trying to solve this problem for a week with no success.
I installed magento2 on my server. Everything works fine on that computer. However, whenever I tried to access the magento2 application from another computer on the same network, the URL's host is rewritten to 'localhost' and it gave me the "unable to connect" error. For example, the url
i don't know where this host translation comes from. Please help.
Please check if you are not only able to access Magento or the whole server.
I think in your database or somewhere in configuration instead of ip address of the server ,loalhost is not updated.
Therefore URL redirect to localhost instead IP address of the server.