Getting Auth Header Text From A Request


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):"### AUTH REQUESTED ### --> %s" %

def start():
    return ApiRequest()

I am running this like so:-

mitmdump -s -p 8020 --nonanonymous

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

curl -x https://user:user@ -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?



We fixed some issues regarding that lately, this will be fixed with the next release:


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