I have a web app running on my local machine.
I want to expose the app on my local corporate network.
I know that I can expose it via the currently assigned ip address as:
http://myipaddress:port/index.html
However I have figured out my local computer name using
scutil --get ComputerName
It returns my computer name as
anands
I have it registered on my /etc/hosts file as
127.0.0.1 anands
But when I try to expose it via
http://anands:port/index.html
people on my local network are not able to access it
Answer
You need to add your IP address (not localhost 127.0.0.1) and name to the local DNS server (another machine on your local network that is used as DNS server). In this way other computers will know that a corresponding name is located to your IP that they can reach.
The way you have done it, you are telling only to your machine that name and others can’t resolve that name to IP without the help of a DNS server
Attribution
Source : Link , Question Author : Andy , Answer Author : Arra Alb