Using IIS

Find the video guide for below instructions over here.

In this guide, we will introduce a Nginx proxy server between user and your candidate application, which will forward the traffic to candidate application and mirror it to HyperTest.

Brief Steps:

  1. Shift candidate application to new url ( for eg: from test.app.latest -> new-test.app.latest)

  2. Add a new site on original candidate url (test.app.latest) We are reusing the same url so nothing changes for the end user. User will still make request calls test.app.latest which will just internally mirror traffic to HyperTest and forward the requests to candidate application on new-test.app.latest.

  3. Configure Reverse proxy to proxy server running in Hypertest VM

  4. Proxy server will then forward traffic to candidate application on new-test.app.latest, while also mirrroing it to HyperTest.

Now lets dive into steps:

1. Install Application Request Routing

  1. Install Application Request Routing from here. This is required for reverse proxy in IIS

Accept the license agreement and install ARR.

2. Shift candidate application to new url

  1. Change the candidate application's url to new-test.app.latest

3. Add new Site

  1. Add a new site in IIS which is accessible on test.app.latest Select an empty folder for physical path \

4. Add Reverse Proxy

  1. Add Reverse proxy to Hypertest VM on port 8003

  • Go to site and URL re-write under IIS

  • Click on Add Rules under Actions from right side\

  • Select Reverse Proxy \

  • Add Inbound Rule Forward HTTP requests to <HypertestVM_IP>:8003

    Check Enable SSL Offloading: required to forward secure requests over HTTP Click ok and add the rule

  • Now click on newly added inbound rule and change pattern from (.*) to ^(.*)$, apply and save the changes.

Reverse proxy from IIS to HyperTest is now complete. We will now add proxy server in HyperTest VM on port 8003 which will forward the traffic original candiate url and mirrror to HyperTest.

5. Deploy Nginx proxy server on Hypertest VM

Create the below two files

docker-compose.yml
version: "3.7"

services:
  nginx:
    image: nginx:alpine
    container_name: external_nginx
    network_mode: host
    volumes:
      - ./nginx-conf.d:/etc/nginx/conf.d/
    restart: always
    logging:
      options:
        max-size: "4m"
        max-file: "10"
nginx.conf
upstream hypertest-internal-logger {
  server <hypertest-vm-ip>:<logger-port>;
}

upstream app-api-latest {
  server new-test.app.latest
}

server {
  listen 8003;
  client_max_body_size 600M;

  access_log off;
  	
  location / {
    mirror /mirror;
    mirror_request_body on;
    ## change this
    proxy_pass http://app-api-latest;
    proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
    proxy_ssl_server_name on;
    proxy_ssl_name $host;
  }
    
  location   = /mirror {
    internal;
    if ($http_fromhypertest) {
      return 400 'mirror loop';
    }
    proxy_connect_timeout 500ms;
    proxy_read_timeout 500ms;
    proxy_pass http://hypertest-internal-logger$request_uri;
    proxy_set_header x-real-host $http_host;
    proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
  }
} 

Deploy the Nginx server with below command

docker-compose -f docker-compose.yml up -d

Verify that the server is up and running using below command:

docker ps| grep nginx

Now our setup to mirror traffic to Hypertest in IIS using reverse proxy is complete.

Whenever the user will access test.app.latest, requests will go to Hypertest VM and it then forward it to candidate application.

To Verify the mirroring setup, hit any api on the application and check for request in "last mirrored requests" section or Session page in HyperTest.

Last updated