aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-09-07 18:05:43 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-09-07 18:05:43 +0200
commit8eff2df89e5be8415aeda526e70e10e023ac1b05 (patch)
tree8210142ceced37e6997c154bca485d510bab9140
parentac27d1236fdbf69c826b5d2bb4c69ebbe8ab40a1 (diff)
downloadmitmproxy-8eff2df89e5be8415aeda526e70e10e023ac1b05.tar.gz
mitmproxy-8eff2df89e5be8415aeda526e70e10e023ac1b05.tar.bz2
mitmproxy-8eff2df89e5be8415aeda526e70e10e023ac1b05.zip
add note that request.host should be used in the majority of cases
-rw-r--r--examples/change_upstream_proxy.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/change_upstream_proxy.py b/examples/change_upstream_proxy.py
index 2e4c6080..86031d29 100644
--- a/examples/change_upstream_proxy.py
+++ b/examples/change_upstream_proxy.py
@@ -11,6 +11,9 @@ alternative_upstream_proxy = ("localhost",8082)
def request(ctx, flow):
if flow.live and should_redirect(flow):
+ # If you want to change the target server, you should modify flow.request.host and flow.request.port
+ # flow.live.change_server should only be used by inline scripts to change the upstream proxy,
+ # unless you are sure that you know what you are doing.
server_changed = flow.live.change_server(alternative_upstream_proxy, persistent_change=True)
if flow.request.scheme == "https" and server_changed:
send_connect_request(flow.live.c.server_conn, flow.request.host, flow.request.port)