Olly Legg home

Proxying SSL Connections with Charles & Faraday

4th Feb 2013

Charles is a great tool for debugging HTTP & HTTPS connections. I has some great documentation for configuring it on OS X. However ruby doesn't use OS X's proxy settings. Recently I needed to use it to debug a issue when using Faraday.

First configure the connections you want to proxy from the Proxy > Proxy Settings > SSL menu. This prevents Charles from unintentionally interfering with all your SSL connections.

Proxy Settings

Now download the Charles CA Certificate bundle. Then you need to configure Faraday to use the proxy. Set the proxy option and the set the ca_file to point to the certificate bundle you just downloaded.

connection = Faraday.new('https://encrypted.google.com', proxy: 'https://localhost:8888', ssl: {ca_file: '~/charles-proxy-ssl-proxying-certificate.crt'})

Et voilà – our proxied request:

Proxied Request