Home > How-to Guides > How to test proxy redirection using a local hosts file

How to test proxy redirection using a local hosts file

This article applies to the following products:

  • Microsoft Exchange

OVERVIEW

This article explains how to logon to OWA in a secondary or disaster recovery site in order to test EPG operations. 


SUMMARY

When logging on to OWA in a secondary or disaster recovery site to test for proper operation, you may experience a silent redirection under the covers, which directs the browser to connect to the primary site where the mailbox is active.  The silent redirection may not be noticed, but the URL in the browser will switch over to the external URL for the primary site. 

For example: 

Site 1 (primary): site1.company.com 

Site 2 (secondary/DR): site2.company.com 

Logging on to “site2.company.com” to a mailbox that is active in “site1.company.com”, a silent redirection will occur, and the logon will occur to site1.company.com

The behavior is explained in Microsoft documentation: 

“… the originating CAS will redirect the request unless the ExternalURL in the target site is the same as in the originating site (and the ExternalURL is the URL entered in the web browser by the user) – in which case CAS will proxy” 

Ref: https://techcommunity.microsoft.com/t5/exchange-team-blog/exchange-2013-client-access-server-role/ba-p/596493 

 


STEPS

To force a logon to the secondary site, and have the Exchange Server in the secondary site act as a proxy to the Exchange Server that hosts the active copy of the user’s mailbox in the primary site, it is necessary to use the URL that matches the primary site’s external OWA URL. 

As this external URL would normally be directed towards the primary site, the workstation that is performing the test needs a DNS override to point the primary site’s name to the IP(s) for the secondary or disaster recovery site. 

I.e. the user types in https://site1.company.com/owa/ but the local workstation’s DNS override points site1.company.com to an IP of an Exchange Server in the secondary site site2. 

 

Create the HOSTS file entry on the local workstation.

  • Open Elevated Command Prompt > Change directory to c:\Windows\System32\Drivers\etc

         cd c:\Windows\System32\Drivers\etc

  • TextDescription automatically generated

 

  • Type  notepad hosts

 

  • The hosts file with open with notepad. Edit the file and add the entry at the bottom and click save

Note that any line that begins with ‘#’ is a comment, and is ignored. 

Example: 10.10.0.123 site1.company.com 

After each edit to the HOSTS file, you have to clear the DNS cache


You can do that by Opening Elevated Command Prompt > type the command ipconfig /flushdns

This test/host file change should be done on a client machine and the external URL must be tested on a browser from a client machine.