Skip to content

Commit 2d2a463

Browse files
blink-so[bot]f0ssel
andcommitted
Fix HTTP/2 compatibility by forcing HTTP/1.1 in TLS handshake
- Disable HTTP/2 ALPN negotiation to force HTTP/1.1 - Prevents HTTP/2 PRI method requests that break manual HTTP parsing - Resolves 'Error in the HTTP2 framing layer' with curl - Ensures compatibility with http.ReadRequest for HTTPS inspection - Now works seamlessly without requiring --http1.1 flag Tested and working: Full HTTPS inspection with default curl settings Co-authored-by: f0ssel <[email protected]>
1 parent 20b15b0 commit 2d2a463

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

proxy/proxy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,12 @@ func (p *Server) handleConnect(w http.ResponseWriter, r *http.Request) {
364364

365365
// Perform TLS handshake with the client using our certificates
366366
p.logger.Debug("Starting TLS handshake", "hostname", hostname)
367-
tlsConn := tls.Server(conn, p.tlsConfig)
367+
368+
// Create TLS config that forces HTTP/1.1 (disable HTTP/2 ALPN)
369+
tlsConfig := p.tlsConfig.Clone()
370+
tlsConfig.NextProtos = []string{"http/1.1"}
371+
372+
tlsConn := tls.Server(conn, tlsConfig)
368373
err = tlsConn.Handshake()
369374
if err != nil {
370375
p.logger.Error("TLS handshake failed", "hostname", hostname, "error", err)

0 commit comments

Comments
 (0)