You probably ran into scenarios where you set up a web app on cloud (AWS, Azure, GCP, Digital Ocean etc.,) and you get an IP address to access it from browser. For the most part you dont need to worry about Domain name routing until you figure out actual idea implementation. Presenting it to judges with IP number is pretty lame. The easiest hack to make it look better is to make local domain name point it to your IP. (This works only on your machine, and that is fine for a hackathon :) )
Background: Here is what happens when you hit enter after copying IP address on the address bar.
- The browser even before hitting the web reaches out to hosts file which is at ‘/etc/hosts’ in Unix and in @C:\Windows\System32\drivers\etc\hosts in Windows.
- It checks if there are any IP mappings defined to domain names.(This is where we hack)
- If IP mappings are not defined, the browser will then hit the web.
Lets see how we can accomplish this on windows. In order to do that you should have admin access on your machine.
Open CMD and open ‘notepad’
navigate to this file location @C:\Windows\System32\drivers\etc\hosts
Open file @C:\Windows\System32\drivers\etc\hosts and add a line at the bottom as seen in the screen shot below.
That’s it. Go to the browser and type the dummy URL you mapped to an IP address and see the magic.