Skip to content

Instantly share code, notes, and snippets.

  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rajiteh/bd04bcb7a535d93827fd7f285e98d7d5 to your computer and use it in GitHub Desktop.
Sets up mitmproxy as a transparent reverse proxy to any upstream (as defined by the host header of the http packets)
#
# ./mitmproxy -U http://doesnt.matter -p 8001 -s mitmproxy_transparent_reverse_proxy.py
#
# HTTP_PROXY=http://localhost:8001 ./program_to_run
#
def request(flow):
if flow.request.method == "CONNECT":
return
if flow.live:
flow.live.change_upstream_proxy_server((flow.request.host, flow.request.port))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment