Configuring Dpcker wptagent to work with Charles Proxy (OSX & Win2012 VM)

Hi there,

I’m running wptagent and wptserver from the Docker containers on OSX.

I need to run all the traffic through Charles Proxy so I can inject the testing script into the pages I’m testing - this is to keep the testing and monitoring project separate from the dev release cycle.

I have agents running on external Windows servers with Charles Proxy, and they intercept traffic and inject code fine for the live sites, but I’m struggling with it in the local setup for internal QA testing pre-release.

I followed the instructions in this article, which seems to work well up to a point:
https://www.bonusbits.com/wiki/HowTo:Setup_Docker_Container_to_Use_Charles_Proxy_on_macOS

The problem is that I can see requests in Charles, but instead of seeing all the traffic, I just see a single request, which is a 301 (redirected), and I’m a bit stumped as to why.

If anyone has any suggestions as to where I may be going wrong, they will be very gratefully received!

I’m now running Charles Proxy on the Windows 2012 VM instead.

The chrome entry in wptdriver.ini is as follows:

[chrome] exe="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" options='--load-extension="%WPTDIR%\extension" --user-data-dir="%PROFILE%"' installer=http://www.webpagetest.org/installers/browsers/bak/chrome.dat command-line='--proxy-pac-url=file:///C:/webpagetest/config.pac'

Note: I have tried both with and without double-quotes around the --proxy-pac-url value, and both double and triple slashes after the URI ‘file:’ protocol
and config.pac is:

[code]function FindProxyForURL(url, host) {
if ((host == “localhost”) ||
(shExpMatch(host, “localhost.*”)) ||
(host == “127.0.0.1”)) {
return “DIRECT”;
}

return “HTTP 127.0.0.1:8888”;
}[/code]

Charles is indeed running on port 8888

When I dispatch a test, I can see it arrive in the agent, and the the wptdriver window says:

Launching: "C:\Program Files (x86)\Google\Chrom SxS\Application\chrome.exe" --load-extension="C:\webpagetest\extension" --user-data-dir="C:\Users\Administrator\AppData\Roaming\webpagetest_profiles\Chrome" --proxy-pac-url-=file:///C:/webpagetest/config.pac

Followed by a bunch of command line options disabling various features (I’ll include them at the end incase they are relevant)

Chrome never launches, and in due course the server says “Timed out waiting for the browser to start.”

(I’ve also tried with Firefox, but FF crashes instantly when opened, and for some reason IE doesn’t show up as an option in the private instance interface.)

Chrome command line options shown when the work request is received:

--disable-background-networking --no-default-browser-check --no-first-run --process-per-tab --new-window --silent-debugger-extension-api --disable-infobars --disable-translate --disable--notifications --disable-desktop-notifications --allow-running-insecure-content --disable-save-password-bubble --disable-component-update --disable-background-downloads --disable-add-to-shelf -- disable-client-side-phishing-detection --disable-data-saver-prompt --disable-default-apps --disable-domain-reliability --safebrowsing-disable-auto-update --disable-background-timer-throttle

There may be more but that’s as far as I’ve been able to stretch the virtual display of the VM!