Fiddler + nginx using analog traffic identification and Forwarding

Recently seen some articles about the full link voltage measurement, all links pressure measured mainly deal with the following issues:

Data cleaning 
pressure measurement flow marks, identifying pressure measuring traffic flag is transmitted
test data and line data isolation
, etc ...

To achieve the full link voltage measurement, it will have to upgrade to the original business system, how to do to minimize the impact on the business of the original code? And middleware can use a proxy to identify and forward traffic.

1. Using fiddler script addition request header

The request header is added as the identification pressure measured flow rate is transmitted between systems.

Click into the fiddler script

 

 

 In OnBeforeRequest () function, add the following statement at:

oSession.oRequest.headers.Add("testmark","1");

Conduct after capture save script, you can see the request in advance we add more fields:

 

 

 

The forwarded request header 2.nginx added

Open nginx configuration file nginx.conf, add the following statement at the location where:

{Server 
  the listen 80;
  server_name XXX
; XXX server ip address
  location / {
    if ($http_testmark){
      proxy_pass http://ip:port;
    }
  }
}

Here we must note

1.if and have a space between the left parenthesis

2. Use $ http_testmark, rather than $ testmark, the use of the latter, nginx will fail to start, suggesting that unknown variable

 

After set up, with "testmark: 1" request field who will be forwarded to ip: port.

 

Guess you like

Origin www.cnblogs.com/wujiecong/p/11573777.html