You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scope proxyauth by proxy mode: transparent/local/WireGuard requests get 401 and lose the origin Authorization header #8631
proxyauth is a single global option with no per-mode or per-listener scope. ProxyAuth.requestheaders authenticates every HTTP flow (mitmproxy/addons/proxyauth.py:75-83). is_http_proxy() is true only for RegularMode and UpstreamMode (mitmproxy/addons/proxyauth.py:143-151); every other mode takes the server-style branch: it reads Authorization, answers 401 with WWW-Authenticate when the header is missing or invalid, and, when it is valid, deletes it (del f.request.headers[auth_header], mitmproxy/addons/proxyauth.py:108).
So with proxyauth enabled, every request captured through transparent, local or WireGuard mode (and reverse mode) is replaced with a 401 unless the client sends proxy credentials as an origin Authorization header. If it does, the origin no longer receives its own Authorization header. One option also applies to every listener in the process, so an authenticated HTTP proxy listener cannot coexist with a transparent capture listener that has no login.
curl -i http://127.0.0.1:8080/ returns 401 with WWW-Authenticate: Basic realm="mitmproxy".
curl -i -H 'Authorization: Basic YWxpY2U6czNjcmV0' http://127.0.0.1:8080/ returns 200, but the origin receives no Authorization header; an origin Authorization: Bearer ... is consumed and rejected before it can be forwarded.
A local- or WireGuard-captured flow goes through the same branch.
Proposal
Scope proxyauth by proxy mode or listener: for example a per-mode/per-listener setting, or apply it only to regular/upstream servers unless explicitly enabled elsewhere.
Outside proxy modes, do not read or delete the request's Authorization header.
Additional context
A desktop UI built on mitmdump serves an explicit HTTP proxy listener with an optional client login and also captures transparent traffic (local redirect, WireGuard) in the same process; the login must not apply to the transparent listeners. Related: #4473 (proxy authentication in reverse mode, where the docs were updated to say mitmproxy falls back to Basic Auth).
Activity
fix(proxyauth): skip proxy authentication for transparently intercept…