I'm having trouble running a selenium test run, using google chrome headless, accessing a site which is only available through a proxy server.
TLDR: Chrome headless can't access sites through a proxy server unless fiddler is running
Trying to diagnose the problem, I've found a strange set of circumstances that cause it to work:
As long as the Internet Explorer proxy is set:
If we install fiddler on the server, the proxy settings are replaced with the Fiddler proxy, and suddenly selenium tests running through chrome (headless) work successfully. And:
If the proxy server configuration is not passed through to chrome (headless), the site is accessed successfully.
Proxy server configuration passed through to chrome using chrome_options.add_argument.
Notes: - There are no chrome extensions enabled.
The website is using HTTP, so there is no issue caused by certificates
Accessing the website via a route that doesn't need a proxy server, such as from our desktops, chrome headless works.
I've tried this on two different servers, with identical behaviour.
The proxy server doesn't require authentication.
So chrome headless can't access the sites through the proxy unless fiddler is running. Does anyone have an idea why this could be, and how I get it working without having Fiddler running?
I used network monitor to see that the headless chrome calls were resolving to a website IP address, rather than that of the proxy, so it looked like headless chrome wasn't using the default proxy, as suspected.
In the end, configuring the nunit tests to pass the proxy server in to headless chrome using the --proxy-server argument did the trick.