Skip to content

Commit ae7f202

Browse files
committed
Fix CONNECT handling in TLS termination path
CONNECT requests coming through TLS termination were incorrectly forwarded as regular HTTP requests instead of being handled by handleConnect. This caused 400 errors when clients used CONNECT. The fix adds proper CONNECT detection in handleDecryptedHTTPS, matching the behavior in handleHTTP.
1 parent 46e6fa2 commit ae7f202

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

proxy/proxy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,12 @@ func (p *Server) handleTLSConnection(tlsConn *tls.Conn, hostname string) {
361361

362362
// handleDecryptedHTTPS handles decrypted HTTPS requests and applies rules
363363
func (p *Server) handleDecryptedHTTPS(w http.ResponseWriter, r *http.Request) {
364+
// Handle CONNECT method for HTTPS tunneling
365+
if r.Method == "CONNECT" {
366+
p.handleConnect(w, r)
367+
return
368+
}
369+
364370
fullURL := r.URL.String()
365371
if r.URL.Host == "" {
366372
// Fallback: construct URL from Host header

0 commit comments

Comments
 (0)