master
Bel LaPointe 2022-12-26 14:15:01 -05:00
parent 3717956a01
commit 0b42c5fac6
1 changed files with 11 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import (
"net"
"net/http"
"net/http/httputil"
"net/url"
"strings"
"time"
@ -104,7 +105,16 @@ func (s *Server) Connect(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) connectHTTPReverseProxy(w http.ResponseWriter, r *http.Request) {
httputil.NewSingleHostReverseProxy(r.URL).ServeHTTP(w, r)
if r.URL.Scheme == "" {
r.URL.Scheme = "https"
r.URL.Host = strings.TrimSuffix(r.URL.Host, ":443")
}
log.Printf("connectHTTPReverseProxy(%+v)", r.URL)
httputil.NewSingleHostReverseProxy(&url.URL{
Scheme: r.URL.Scheme,
Host: r.URL.Host,
Path: "/",
}).ServeHTTP(w, r)
}
func (s *Server) Serve(w http.ResponseWriter, r *http.Request) {