mitmproxy / mitmproxy/mitmproxy
In upstream mode, https requests will cause changes in flow.mode
Open
Nobody has claimed this yet.
kind/triage
- Dominant language
- Python
- Stars
- 45.1k
- Forks
- 4.7k
- Avg merge
- 21h 12m
- Merged PRs (30d)
- 16
Description
Problem Description
In upstream mode, https requests will cause changes in flow.mode.
Steps to reproduce the behavior:
proxy.py
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
if flow.request.method == "CONNECT":
return
if flow.live:
print("flow.mode:", flow.mode)
host = "127.0.0.1"
port = 7890
flow.live.change_upstream_proxy_server((host, port))
run bash
mitmdump -p 8081
mitmdump --mode upstream:http://127.0.0.1:8081 -s proxy.py --ssl-insecure
export http_proxy=http://127.0.0.1:8080
export https_proxy=http://127.0.0.1:8080
result
$ curl https://httpbin.org/get
...
flow.mode: upstream
...
$ curl https://httpbin.org/get -k
...
flow.mode: transparent
...
System Information
$ mitmproxy --version
Mitmproxy: 4.0.4
I don't know if this is a bug, but I think #3721 and #2123 are related to this issue.
English is not my native language; please excuse typing errors.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with the provided mitmdump, proxy.py, and curl commands, comparing requests with and without -k. Trace where flow.mode changes during HTTPS handling and upstream proxy switching; done when HTTPS requests preserve the expected upstream mode without regressing the shown cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100