Jeff Sanders Technical Blog

I am a Microsoft employee that has worked on all aspects of the Web Stack for a long time. I hope these blogs are useful to you! Use this information at your own risk.


<< Go Back

Test In Production Specify Slot And Test With Custom Domain Name

- 14 Mar 2019

You can use Deployment Slots and direct a percentage of the production traffic to a particular slot.  If you want to test only that slot say with the custom Domain on the production slot and ensure you hit that slot, you need to add a Cookie called x-ms-routing-name and specify that slot I want to route to.  In this example I am going to route to the test slot:

Accept-Encoding: gzip, deflate, br
  Accept-Language: en-US,en;q=0.9
  Cookie: x-ms-routing-name=test

There a few tools you can use to do this but Fiddler is one of my favorite.  To do this you can modify the rules in fiddler and look for the domain of concern, and when found… add that cookie. 

To Modify the Rules

  1. go to the Rules, Customize Rules section (ctrl+R).

  2. In the editor find the section: function OnBeforeRequest(oSession: Session)

  3. Add a rule similar to this where the uri is your site domain name and the cookie is the slot name you are wanting to redirect to.

//Rule: add cookie for URLs containing “mytestsite.com”
if (oSession.uriContains(“mytestsite.com“) ) {
      oSession.oRequest[“Cookie”] = (oSession.oRequest[“Cookie”] + “;x-ms-routing-name=test“);
}

Then run Fiddler and test your slot!

Some other important things

1.  Ensure you are running fiddler and capturing traffic (F12).

  1. If the requests include HTTPS traffic ensure you are decrypting HTTPS traffic (Tools, Options, HTTPS, check Decrypt HTTPS traffic):

DecryptHTTPS 2019-03-14 110222

  1. Close all browsers and then use an in-private or incognito browser session to ensure you are not getting cached content.
<< Go Back