All Around Microsoft Dynamics Business Central

Debug HttpClient Request inside a Container

If you use a BC Container to develop a WebService connetction, it is hard to analyse the traffic with only the Debugger.

Fiddler Classic can be used to solve this problem.

Fiddler Classic can be used as reverse proxy. To do so go to Tools -> Options and enable the „Allow remote computers to connect“.

Click OK and restart fiddler.

After that we need to add the reverse proxy code.

First stop the default capturing by clicking on the „Capturing…“ text in the statusbar.

Go to Rules -> Customize Rules… and now  add

if (oSession.host.toLowerCase() == "host.containerhelper.internal:8888") {
    oSession.host = "google.com:443";
    oSession.oRequest.headers.UriScheme = 'https';
}

to the OnBeforeRequest function. Now any request that is send to http://host.containerhelper.internal:8888 will be captured and redirected to https://google.com:443/