Skip to content

Commit c297fa5

Browse files
blink-so[bot]f0ssel
andcommitted
Add debug logging for TLS termination troubleshooting
- Add detailed logging in handleHTTPConnection to trace execution - Add logging in handleHTTP to confirm request processing - Helps diagnose connection issues in privileged mode - No functional changes, only improved observability Co-authored-by: f0ssel <[email protected]>
1 parent 1fadbfa commit c297fa5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

proxy/proxy.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ func (p *Server) Stop() error {
131131

132132
// handleHTTP handles regular HTTP requests and CONNECT tunneling
133133
func (p *Server) handleHTTP(w http.ResponseWriter, r *http.Request) {
134+
p.logger.Debug("handleHTTP called", "method", r.Method, "url", r.URL.String(), "host", r.Host)
135+
134136
// Handle CONNECT method for HTTPS tunneling
135137
if r.Method == "CONNECT" {
136138
p.handleConnect(w, r)
@@ -529,21 +531,29 @@ func (p *Server) handleTLSTermination(conn net.Conn, firstByte []byte) {
529531

530532
// handleHTTPConnection handles regular HTTP connections
531533
func (p *Server) handleHTTPConnection(conn net.Conn, firstByte []byte) {
534+
p.logger.Debug("Starting HTTP connection handling")
535+
532536
// Create a connection that prepends the first byte we already read
533537
connWithFirstByte := &connectionWithPrefix{
534538
Conn: conn,
535539
prefix: firstByte,
536540
}
537541

542+
p.logger.Debug("Created connection wrapper, starting HTTP server")
543+
538544
// Create HTTP server to handle this connection
539545
server := &http.Server{
540546
Handler: http.HandlerFunc(p.handleHTTP),
541547
}
542548

549+
p.logger.Debug("About to serve HTTP connection")
550+
543551
// Serve the HTTP request
544552
err := server.Serve(&singleConnListener{conn: connWithFirstByte})
545553
if err != nil && err != io.EOF && !isConnectionClosed(err) {
546554
p.logger.Debug("HTTP connection error", "error", err)
555+
} else {
556+
p.logger.Debug("HTTP connection completed successfully")
547557
}
548558
}
549559

0 commit comments

Comments
 (0)