diff options
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/prxy/prxy.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/pkg/prxy/prxy.go b/pkg/prxy/prxy.go index 0e6e8c31..1e378b3d 100644 --- a/pkg/prxy/prxy.go +++ b/pkg/prxy/prxy.go @@ -18,17 +18,16 @@ func New(routes map[string]string) http.Handler { } return &httputil.ReverseProxy{ - Director: func(r *http.Request) { - host, _, err := net.SplitHostPort(r.Host) + Rewrite: func(r *httputil.ProxyRequest) { + host, _, err := net.SplitHostPort(r.In.Host) if err != nil { - fmt.Printf("%v\n", err) + log.Println(err) return } destination := mapped[host] - r.URL.Scheme = destination.Scheme - r.Host = destination.Host - r.URL.Host = destination.Host + r.SetXForwarded() + r.SetURL(destination) }, Transport: http.DefaultTransport, FlushInterval: -1, |
