Using Fiddler to capture K2 Host Server requests
KBS100076
PRODUCTThis should be done for debugging purposes, i.e. when you want an easy way to redirect all K2 HostServer web traffic to go through Fiddler.
Running Fiddler with this method should only be done for debugging purposes and never on Production Systems.
Configuring Your System to Use Fiddler for Debugging
Please follow these instructions:
- Download the latest copy of Fiddler using this link and install it on your K2 Server
- Stop the K2 Blackpearl service.
- Open "K2 blackpearlHost ServerBinK2HostServer.exe.Config" with a text editor.
- Add the following code to the <system.net> section after editing the proxyaddress value to match your environment.
<defaultProxy enabled="true" useDefaultCredentials = "true">
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:9999" usesystemdefault="false" />
</defaultProxy>
To get the values for the "proxyaddress" element open Fiddler, and select Tools > Options and click on the Connections tab.
Click on the link "Copy Browser Proxy Configuration URL" and paste the link into a text editor, the contents should look as follows:
file:///C:/Users/Admin/Documents/Fiddler2/Scripts/BrowserPAC.js
Locate the JS file and edit in a Text Editor, the contents of the file should look as follows:
function FindProxyForURL(url, host){
return 'PROXY 127.0.0.1:9999';
}
You can use the IP and Port in the "proxyaddress" element.
5. Start the K2 Blackpearl Service.
6. When saving the Fiddler Trace, make sure to save it as a .saz file (Session Archive)
Edit the OnBeforeRequest static function in FiddlerScript and replace the ‘host name’ placeholder with your environment’s host name:
if (oSession.host.Contains("host-name")) {
oSession)"https-Client-Certificate"] = "C:\temp\EnvOwner.cer";
}else{
oSession"https-Client-Certificate"] = "C:\temp\EnvContributor.cer";
}
Save the script
8. Open the Certificate Manager by pressing “Windows + R” and searching “certlm.msc”
- There is no need to export the private key.
- These files are used for the FiddlerScript to work
- Restart Fiddler
- Start the K2 Server
Your host server will route all web traffic through Fiddler. You can disable this by changing the enabled flag to false as indicated below, then restarting the host server.
<defaultProxy enabled="false" useDefaultCredentials = "true">
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:9999" usesystemdefault="false" />
</defaultProxy>
Once you enable host server traffic through Fiddler you’ll start to see entries like the following:
(The following example is when K2 is getting OAuth Tokens):
If your browser is set to "Autodetect proxy settings" these settings might override the browser proxy settings (even if set to enabled=false) .
Once you have completed your debugging tests, remove the 'defaultProxy' section and restart your K2 Blackpearl Server.