Getting Auth Header Text From A Request

Hi,

So I am running a simple piece of code to extract Authorization header from a request. Like so:-

from mitmproxy import ctx


class ApiRequest(object):

    def apirequest(self, flow):
        ctx.log.info("### AUTH REQUESTED ### --> %s" %
                     flow.request.headers['Proxy-Authorization'])


def start():
    return ApiRequest()

I am running this like so:-

mitmdump -s test.py -p 8020 --nonanonymous

Point my local MAC to use this proxy and I try a curl like this:-

curl -x https://user:user@127.0.0.1:8020 -vvv url

I always get back a 401 no matter what and a KeyError on the request.

I want to retreive the Proxy-Authorization b64 encoded string so that I can pass auth to my own backend.

How do I achieve this?

Thanks,

Hi,

We fixed some issues regarding that lately, this will be fixed with the next release:
https://github.com/mitmproxy/mitmproxy/issues/1734
https://github.com/mitmproxy/mitmproxy/issues/2019

Best,
Max

Ok, thanks Max. Ill keep an eye out for this fix.