# How to access upstream server from responseheaders event?

**URL:** <https://discourse.mitmproxy.org/t/how-to-access-upstream-server-from-responseheaders-event/1539>\
**Category:** help\
**Created:** [May 10, 2019, 7:14am UTC](https://discourse.mitmproxy.org/t/how-to-access-upstream-server-from-responseheaders-event/1539 "2019-05-10T07:14:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![appunni-dishq](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@appunni-dishq](https://discourse.mitmproxy.org/u/appunni-dishq)\
**Post date:** [May 10, 2019, 7:14am UTC](https://discourse.mitmproxy.org/t/how-to-access-upstream-server-from-responseheaders-event/1539/1 "2019-05-10T07:14:40Z")

</div>

````auto
from .mechanism import StatManager
import mitmproxy

class StatAddon:

    def responseheaders(self, flow: mitmproxy.http.HTTPFlow):
        """
            HTTP response headers were successfully read. At this point,
            the body
            is empty.
        """
        StatManager(
            flow.response.headers["host"],
            flow.response.status_code,
            # third parameter is proxy used, how to access it from here ?
        )```
````
