from mitmproxy import http def request(flow): # Then handle the redirect for other requests if flow.request.pretty_host.endswith("pmang.cloud"): flow.request.host = "127.0.0.1" flow.request.port = 8443 flow.request.scheme = "https" flow.request.headers["Host"] = "localhost"