Browse Source

auto update script executed

Toby Chui 1 year ago
parent
commit
79e1542ed6
1 changed files with 4 additions and 1 deletions
  1. 4 1
      mod/dynamicproxy/dpcore/dpcore.go

+ 4 - 1
mod/dynamicproxy/dpcore/dpcore.go

@@ -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)