From 1a762cdce56f57b74ed3b5de74e1dc11be6fc812 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 26 Sep 2016 18:03:18 -0700 Subject: [PATCH] override host header in reverse proxy mode, refs #1571 --- mitmproxy/protocol/http.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mitmproxy/protocol/http.py b/mitmproxy/protocol/http.py index 894ae4659..e14879436 100644 --- a/mitmproxy/protocol/http.py +++ b/mitmproxy/protocol/http.py @@ -184,6 +184,10 @@ class HttpLayer(base.Layer): self.channel.ask("error", flow) return + # update host header in reverse proxy mode + if self.mode == "reverse": + flow.request.headers["Host"] = self.config.upstream_server.address.host + # set upstream auth if self.mode == "upstream" and self.config.upstream_auth is not None: flow.request.headers["Proxy-Authorization"] = self.config.upstream_auth