In IPv4, the local machine loopback IP 127.0.0.1 is mapped to the hostname localhost. For the majority of testing situations, this will be fine. However, there are a few reasons you might want to associate your local machine with your organization's public domain name or even an arbitrary domain name but yet have this name resolve entirely on the local machine instead of the public internet.
- You are testing SSL certificates and are using a production certificate. This will cause redirections to the actual Public domain, which will conflict with your test environment.
When testing SSL certificates in a test environment, many people will generate a self-signed certificate tied to the localhost instead of the public domain. However, this is not always ideal. Testing might require ensuring that the actual public certificate is valid and works alongside the web application. The problem is that the production certificate is generated using your actual public domain, as soon as a redirect is performed, you will be dumped out of your test environment and into the public site.
- Parts of your web application built in-house have hard-coded references to the domain and you do not want to be taken out to the public internet during testing.
- Simplified URL entry into the address bar or using the DNS as a hostname.
This article will outline the steps to add an alias to the hosts file in a Windows Environment, which will redirect a DNS name to the loopback IP address. The resolution steps will apply to Linux and other *nix Systems.
FileCatalyst Server v3.4 and later.
FileCatalyst Workflow v4.9 and later.
FileCatalyst Webmail v4.9 and later.
- Click the Start button and search for notepad.exe.
- Right-click on Notepad and select Run as Administrator.
- Browse to C:\Windows\system32\drivers\etc\ and open the hosts file.
- On a new line, enter the IP followed by the domain name, separated by at least one space. For example: 127.0.0.1 www.mydomain.com
- Save the file and close Notepad.
- Restart your machine for the changes to take effect.
Whenever www.mydomain.com is called, this DNS will resolve to 127.0.0.1 on this machine.