Headless Chrome is not redirecting
I was having the same issue and as you pointed out it happens with sites that have bad certificates. Passing the --ignore-certificate-errors
flag didn't work at the time of the original post as there was a bug.
Some options to pass to have chrome-headless send more debugging info: --log-level=0 --enable-logging --v=1 bug tracker for chrome/chromium headless not accepting the --ignore-certificate-errors flag: bugs.chromium.org/p/chromium/issues/detail?id=721739 – karlos Dec 7 '17 at 20:15
For anyone reading now the bug was patched recently here: https://chromium.googlesource.com/chromium/src.git/+/c8f0691b18dc5d941d5b6b3c67a483da02400670
And the --ignore-certificate-errors
flag should allow redirects to occur when using headless chrome for sites with bad certificates.
as to date seems like --enable-features=NetworkService
solves the issue of self signed certificated in headless mode