Task1: Using Fiddler as a Proxy to Monitor Request from a Java Application
To configure a Java application to send web traffic to Fiddler, add the following parameters to JVM:
-Dhttp.proxyHost=proxyHost -Dhttp.proxyPort=8888

The proxy – here is the Fiddler and the java application can be run in different machines. In this case, ensure allow remote clients to connect is checked by clicking “Tools” -> “Fiddler Options” -> “Connections” -> “Allow remote computers to connect”. Then restart Fiddler.

Use Apache Http Client SystemDefaultHttpClient
If you are using Apache Http Client 4.2 or newer, we can use SystemDefaultHttpClient which honor standard system properties.

In 4.3 or newer, we can use HttpClientBuilder, which also honors these system properties.
HttpClient client = HttpClientBuilder.create().build();

Task2: Monitor Requests in Web Server
We want to monitor request and response in Java web server, for example: the web server is running at server1:8080.

document.write("(adsbygoogle = window.adsbygoogle || []).push({});”)

Solution: Using Fiddler as a Reverse Proxy
We can use fiddler as a reverse proxy, first we change Fidder to listen on Port 8080 by right clicking “Tools” -> “Fiddler Options” -> “Connections”: change port number and allow remote computers to connect, then restart Fiddler if prompted.

Then change web server to run at another port, for example: 9090.

Create a FiddlerScript Rule
Then write a custom rule to tell Fidder to forward requests to server1:8080(the port Fiddler is listening) to server1:9090 where the real web server is listening.

Click Rules > Customize Rules.
Inside the OnBeforeRequest handler*, add a new line of code:
if (oSession.host.toLowerCase() == “server1:8080”) oSession.host = “server1:9090”;

Troubleshooting: Enable “Help” -> “Troubleshooting Filters…” 
If for some reason, fiddler is not capturing the request, we can enable option: “Help” -> “Troubleshooting Filters…”. This will show all traffic but strike out the requests that would be excluded by the filter.  It also provides a comment about why the request would be hidden. 

The Fiddler Proxy
Using Fiddler as a Reverse Proxy

via Blogger http://ift.tt/1oJLKoB