karma-runner/karma — pull request #1160 by JayBerlin (2014-08-15 21:29:17+00:00)
Title: Fix 581 https support for karma server

This PR implements support for running the karma proxy server as https so that karma is able to proxy a secure site and handle secure cookies. It really just some formalization of [danielabar's hack](https://github.com/danielabar/hack-karma-https) as I need this to support some internal e2e testing using karma.

To us this, add this to the karma.conf.js file:

protocol: 'https'

By default, this will create a self-signed certificate that lasts 1 day to be used by the karma server. If you want to supply your own certificate, add the following property to the karma.conf.js file:

cert: {
key: 'name_of_key.pem_file',
cert: 'name_of_cert.pem_file'
}

Caveats:

* If you are using self-signed certificates, you need to modify the karma-chrome-launcher module by adding these additional options when launching:

'--ignore-certificate-errors',
'--ignore-urlfetcher-cert-requests',

Otherwise, the browser will hang waiting for a confirmation that it is okay to visit a site with a self-signed certificate. I have not found a way to do this for Firefox or other browsers.

* I found that I had to use version 0.8.3 of the modified [node-http-proxy](https://github.com/jayv/node-http-proxy) in place of the default http-proxy in order to run e2e tests with embedded frames. This version properly handles location header rewriting so that access to proxied content within an iframe works properly. This was an issue for us when redirects were occurring.

Not sure if this is worth pulling into karma for everyone as there are some pretty big caveats, but wanted to get a PR in place as we are using this now.