#7920·mitmproxy

Switching upstream proxy works on HTTPS but failed on HTTP

Author: ShnitzelilCreated Oct 15, 2025Updated Sep 10, 2026
Labelskind/triage

Problem Description

Using the examples/contrib/upstream_pac.py Some of the URLs/Hosts redirected to Proxy (Next Hop). URLs that using secured channel (HTTPS) works fine. URLs that using plain channel (HTTP) failed as they forced to use CONNECT.

My guess is the condition on http/init.py#L1128

Update[September 10th, 2026] - maybe we should add HTTPMode (enum) with type pac so it will handle this dynamic mode.

Steps to reproduce the behavior:

  1. Use the upstream_pac.py
  2. Point to pac
  3. access Both HTTPS and HTTP.
  4. HTTPS will works fine
  5. HTTP will failed as it try to use CONNECT.

System Information

Mitmproxy: 12.1.2 binary
Python:    3.13.7
OpenSSL:   OpenSSL 3.5.2 5 Aug 2025
Platform:  Windows-11-10.0.26100-SP0

Checklist