Search code examples
dnsiphostsame-origin-policy

Default host name for an IP address


If an IP address doesn't have a hostname set in the hosts file, and it also doesn't have a binding domain name, then what is its hostname, the IP address itself? Since same-origin policy asks for the same host, not for the same IP, so it must have a hostname.


Solution

  • If you are trying to access from the same machine it can be accessed via:

    1. localhost
    2. 127.0.0.1
    3. 0.0.0.0

    P.S. If you are on a different machine and no domain is mapped to the IP address, then IP address itself will be the host name until a domain is explicitly mapped to it. You might have to do some additional setup depending on your use case to make it remotely accessible.