# Https with custom ca bundle

**URL:** <https://discourse.mitmproxy.org/t/https-with-custom-ca-bundle/408>\
**Category:** help\
**Created:** [March 8, 2017, 9:32pm UTC](https://discourse.mitmproxy.org/t/https-with-custom-ca-bundle/408 "2017-03-08T21:32:45Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![kafonek](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/kafonek/32/128_2.png) [@kafonek](https://discourse.mitmproxy.org/u/kafonek)\
**Post date:** [March 10, 2017, 3:37pm UTC](https://discourse.mitmproxy.org/t/https-with-custom-ca-bundle/408/14 "2017-03-10T15:37:01Z")

</div>

Sweet, this is almost entirely working.

Just to document what I’ve done based on your amazingly-helpful suggestions.

I created a pem file from mycert.crt and mycert.key that can be used with mitmdump --client-cert. cat mycert.key mycert.crt \> mycert.pem.

Once that is done, then I can run this `mitmdump --upstream-trusted-ca custom_ca_bundle.pem --client-cert mycert.pem`

```python
import requests
proxies = {'http' : 'http://localhost:8080',
           'https' : 'http://localhost:8080'}
url_1 = 'http://corporate.intranet.site'
url_2 = 'https://secure.intranet.site'

requests.get(url_1, proxies=proxies)
>>> <Response [200]>

requests.get(url_2, proxies=proxies)
>>> Error: tlsv1 alert unknown ca sni: mycert domain name

requests.get(url_2, proxies=proxies, verify=False)
>>> <Response [200]>

```

From my app, I can see the ssl domain name of the connection coming in is my proxy server, wonderful. Last question for now would be whether you knew why my own cert is throwing certificate verification errors. I added the text of mycert.crt (–begin certificate-- etc) into my custom\_ca\_bundle and the issuer of mycert.crt should already be in that bundle anyways. The ~/.mitmproxy/mitmproxy-ca-cert.pem text is also in my custom\_ca\_bundle.

Thanks again for the education and help mhils.

---

_[View the full topic](https://discourse.mitmproxy.org/t/https-with-custom-ca-bundle/408)._
