From 884fd60e26b8beaa3785ea3d708c2d4386707f93 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 9 Mar 2023 16:48:26 +0100 Subject: [PATCH] fix #5972 (#5982) --- mitmproxy/addons/next_layer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mitmproxy/addons/next_layer.py b/mitmproxy/addons/next_layer.py index 81244b2c1..2687e9474 100644 --- a/mitmproxy/addons/next_layer.py +++ b/mitmproxy/addons/next_layer.py @@ -349,7 +349,10 @@ class NextLayer: elif starts_like_tls_record(data_client): stack /= layers.ClientTLSLayer(context) - stack /= layers.HttpLayer(context, HTTPMode.regular) + if isinstance(context.layers[0], modes.HttpUpstreamProxy): + stack /= layers.HttpLayer(context, HTTPMode.upstream) + else: + stack /= layers.HttpLayer(context, HTTPMode.regular) return stack[0]