boo
This commit is contained in:
12
server.go
12
server.go
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user