|
@@ -2,6 +2,7 @@ package dpcore
|
|
|
|
|
|
import (
|
|
|
"errors"
|
|
|
+ "fmt"
|
|
|
"io"
|
|
|
"log"
|
|
|
"net"
|
|
@@ -238,7 +239,7 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
|
|
|
transport = http.DefaultTransport
|
|
|
}
|
|
|
|
|
|
- hostname := req.Host
|
|
|
+ hostname := req.Header.Get("Host")
|
|
|
|
|
|
outreq := new(http.Request)
|
|
|
// Shallow copies of maps, like header
|
|
@@ -311,6 +312,8 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
|
|
|
domainWithoutPort = strings.Split(rrr.ProxyDomain, ":")[0]
|
|
|
}
|
|
|
|
|
|
+ fmt.Println(hostname)
|
|
|
+
|
|
|
//Replace the forwarded target with expected Host
|
|
|
locationRewrite = strings.ReplaceAll(locationRewrite, rrr.ProxyDomain, hostname)
|
|
|
locationRewrite = strings.ReplaceAll(locationRewrite, domainWithoutPort, hostname)
|