2020-06-22 23:53:39 +00:00
|
|
|
"""Redirect HTTP requests to another server."""
|
2017-04-28 21:56:14 +00:00
|
|
|
from mitmproxy import http
|
2016-11-21 01:16:20 +00:00
|
|
|
|
|
|
|
|
2017-04-28 21:56:14 +00:00
|
|
|
def request(flow: http.HTTPFlow) -> None:
|
2016-11-21 01:16:20 +00:00
|
|
|
# pretty_host takes the "Host" header of the request into account,
|
|
|
|
# which is useful in transparent mode where we usually only have the IP
|
|
|
|
# otherwise.
|
|
|
|
if flow.request.pretty_host == "example.org":
|
|
|
|
flow.request.host = "mitmproxy.org"
|