Set Host header to Tunnel.Domain

This commit is contained in:
Anders Pitman 2022-09-27 12:03:18 -06:00
parent e7bd69ddf1
commit efcaae77b5

View File

@ -75,7 +75,10 @@ func proxyRequest(w http.ResponseWriter, r *http.Request, tunnel Tunnel, httpCli
upstreamReq.Header.Set("X-Forwarded-For", xForwardedFor)
upstreamReq.Header.Set("Forwarded", fmt.Sprintf("for=%s", remoteHost))
upstreamReq.Host = fmt.Sprintf("%s:%d", tunnel.ClientAddress, tunnel.ClientPort)
// TODO: This might need to be more generic, but using r.Host. However,
// I think that may have security implications for things like DNS
// rebinding attacks. Not sure.
upstreamReq.Host = tunnel.Domain
upstreamRes, err := httpClient.Do(upstreamReq)
if err != nil {