from mitmproxy.http import HTTPFlow def requestheaders(flow: HTTPFlow) -> None: host = flow.request.pretty_host flow.request.host = '127.0.0.1' flow.request.port = 4001 flow.request.headers['X-Forwarded-Proto'] = flow.request.scheme flow.request.scheme = 'http' flow.request.host_header = host