Follow

How Do I Test by Editing the HOSTS File?

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

  1. Navigate to Windows Start menu > All Programs > Accessories.
  2. Right-click the Notepad icon and select Run as Administrator.
  3. Select Continue and grant permission on the Windows Needs Your Permission User Access Control (UAC) window.
  4. In Notepad, select File > Open.
  5. Enter “C:\Windows\System32\Drivers\etc\hosts” in the filename field and click Open.
  6. 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

  1. Navigate to Applications > Utilities > Terminal.
  2. Enter “sudo nano /private/etc/hosts” to open the HOSTS file.
  3. Enter your user password, when prompted.
  4. 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.
  5. Save the HOSTS file by pressing Control+X.
  6. Refresh DNS values by entering “sudo dscacheutil -flushcache.”
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments