Why Would I Need to do This?
Your local hosts file serves as an authoritative DNS data store for your local computer. You can edit your hosts file to map any domain or subdomain to a specific IP address. Modifying your local host is an easy way to control what IP address your browser will use to send HTTP traffic for a particular domain or subdomain.
Test Before Onboarding
Before onboarding your production domain to Distil, it is advisable to send a bit of test traffic through the Distil network to verify that everything will work as expected. In most cases, everything works as expected, but finding out before making a DNS change is certainly best practice.
Test When Troubleshooting
After moving your production domain to Distil, you may find the need to test your site directly, bypassing Distil. This is a key step in troubleshooting when trying to isolate the cause of site performance or server errors.
How do Modify My Hosts File?
The quickest way to test your site on the Distil service is to modify your local HOSTS file to resolve DNS requests against Distil. This will ensure your domain routes to Distil then to your origin server. This will accurately simulate what traffic will look like against Distil.
Editing HOSTS in Windows Vista and Windows 7
- Navigate to Windows Start menu > All Programs > Accessories.
- Right-click the Notepad icon and select Run as Administrator.
- Select Continue and grant permission on the Windows Needs Your Permission User Access Control (UAC) window.
- In Notepad, select File > Open.
- Enter “C:\Windows\System32\Drivers\etc\hosts” in the filename field and click Open.
- Add an entry for [yourdomain.com] and [www.yourdomain.com] pointing at the Distil IP provided under the Show DNS Configuration Instructions page in the Distil Portal (Domains > [yourdomain.com] > Settings > Show DNS Configuration Instructions).
Editing HOSTS in Mac OSX
- Navigate to Applications > Utilities > Terminal.
- Enter “sudo nano /private/etc/hosts” to open the HOSTS file.
- Enter your user password, when prompted.
- Add an entry for [yourdomain.com] and [www.yourdomain.com] pointing at the Distil IP provided under the Show DNS Configuration Instructions page in the Distil Portal (Domains > [yourdomain.com] > Settings > Show DNS Configuration). This should go at the bottom of the file.
- Save the HOSTS file by pressing Control+X.
- Refresh DNS values by entering “sudo dscacheutil -flushcache.”