# Errno 61 Connection refused

**URL:** <https://discourse.mitmproxy.org/t/errno-61-connection-refused/418>\
**Category:** help\
**Created:** [March 20, 2017, 8:44am UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418 "2017-03-20T08:44:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![PranavPrakash52](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PranavPrakash52](https://discourse.mitmproxy.org/u/PranavPrakash52)\
**Post date:** [March 20, 2017, 8:44am UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/1 "2017-03-20T08:44:36Z")

</div>

I am trying to run mitmdump in my machine(osx 10.11.5).But whenever i send https requests to the server i get error 61 connection refused.it happens only with https requests http works fine .I am using mitmproxy version 2.0.0 and python 3.5.2 . Please go through the screenshot.

 ![](https://canada1.discourse-cdn.com/flex030/uploads/mitmproxy1/original/1X/f4c6db32b1d476cef7779ba2934cef5d2ab93d41.png)

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [March 21, 2017, 7:37pm UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/2 "2017-03-21T19:37:39Z")

</div>

This looks like a bug in your `update.py` script. For any more useful insights you’d need to post that. 😉

---

<div class="post-metadata">

**Author:** ![PranavPrakash52](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PranavPrakash52](https://discourse.mitmproxy.org/u/PranavPrakash52)\
**Post date:** [March 21, 2017, 8:25pm UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/3 "2017-03-21T20:25:21Z")

</div>

Thank you for looking into the problem.

```
def proxy_address(flow):
    return ('proxyip', port)

def request(flow):
    try:
        address = proxy_address(flow)
        if flow.live:
            flow.live.change_upstream_proxy_server(address)
    except Exception:
        print(Exception)

```

The code is same as change\_upstream\_proxy.py in the examples.The proxy\_address function just returns a proxyaddress

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [March 21, 2017, 11:43pm UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/4 "2017-03-21T23:43:29Z")

</div>

Ah yes. That’s a bug currently, but is already fixed on master and will be out with the next release. Sorry for the trouble.

---

<div class="post-metadata">

**Author:** ![PranavPrakash52](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PranavPrakash52](https://discourse.mitmproxy.org/u/PranavPrakash52)\
**Post date:** [March 22, 2017, 11:52am UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/5 "2017-03-22T11:52:11Z")

</div>

sir i tried pulling the master and tried running the script using `mitmdump -m upstream:https://127.0.0.1:8085 -s updateitmproxy.py` i still get the error `Server connection to ('127.0.0.1', 8085) failed: Error connecting to "127.0.0.1": [Errno 61] Connection refused`.

---

<div class="post-metadata">

**Author:** ![PranavPrakash52](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PranavPrakash52](https://discourse.mitmproxy.org/u/PranavPrakash52)\
**Post date:** [April 8, 2017, 5:58am UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/6 "2017-04-08T05:58:19Z")

</div>

sir i tried pulling the master and tried running the script using `mitmdump -m upstream:https://127.0.0.1:8085 -s updateitmproxy.py` i still get the error`Server connection to ('127.0.0.1', 8085) failed: Error connecting to "127.0.0.1": [Errno 61] Connection refused.`

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [April 8, 2017, 10:16pm UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/7 "2017-04-08T22:16:00Z")

</div>

> [@PranavPrakash52](#):
>
> Error connecting to “127.0.0.1”: [Errno 61] Connection refused.

This means there is no server listening on your local machine on port 8085.

---

<div class="post-metadata">

**Author:** ![PranavPrakash52](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PranavPrakash52](https://discourse.mitmproxy.org/u/PranavPrakash52)\
**Post date:** [April 9, 2017, 6:10am UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/8 "2017-04-09T06:10:58Z")

</div>

So mitmdump command is not working ??can u suggest what I should differently .This problem was not there when I was using mitmproxy version 0.18.2. I tried using all the other versions after 0.18.2 they all give me the same error.

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [April 13, 2017, 3:52pm UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/9 "2017-04-13T15:52:45Z")

</div>

Again, the error message states that you have no server listening on 127.0.0.1:8085. When you invoke mitmproxy you instruct it to connect to said address, that doesn’t work and mitmproxy complains rightfully. There is no mitmproxy bug here.

---

<div class="post-metadata">

**Author:** ![PranavPrakash52](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PranavPrakash52](https://discourse.mitmproxy.org/u/PranavPrakash52)\
**Post date:** [April 13, 2017, 4:21pm UTC](https://discourse.mitmproxy.org/t/errno-61-connection-refused/418/10 "2017-04-13T16:21:23Z")

</div>

Thank you I will look into it.
