Skip to content

Commit 742e09a

Browse files
committed
fix: set host and scheme if not set on http proxy
1 parent 00ac2f7 commit 742e09a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

proxy/proxy.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ func (p *Server) handleHTTP(w http.ResponseWriter, r *http.Request) {
116116
return
117117
}
118118

119+
// Ensure URL is fully qualified
120+
if r.URL.Host == "" {
121+
r.URL.Host = r.Host
122+
}
123+
if r.URL.Scheme == "" {
124+
r.URL.Scheme = "http"
125+
}
126+
119127
// Check if request should be allowed
120128
result := p.ruleEngine.Evaluate(r.Method, r.URL.String())
121129

@@ -523,4 +531,4 @@ func (sl *singleConnectionListener) Addr() net.Addr {
523531
return nil
524532
}
525533
return sl.conn.LocalAddr()
526-
}
534+
}

0 commit comments

Comments
 (0)