aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/protocol/http.py
diff options
context:
space:
mode:
Diffstat (limited to 'mitmproxy/protocol/http.py')
-rw-r--r--mitmproxy/protocol/http.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mitmproxy/protocol/http.py b/mitmproxy/protocol/http.py
index e1487943..d3e3c80f 100644
--- a/mitmproxy/protocol/http.py
+++ b/mitmproxy/protocol/http.py
@@ -185,8 +185,11 @@ class HttpLayer(base.Layer):
return
# update host header in reverse proxy mode
- if self.mode == "reverse":
- flow.request.headers["Host"] = self.config.upstream_server.address.host
+ if self.config.options.mode == "reverse":
+ if six.PY2:
+ flow.request.headers["Host"] = self.config.upstream_server.address.host.encode()
+ else:
+ 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: