From 646dd6f1add5daeae15ba602bd62aeea8f12adbc Mon Sep 17 00:00:00 2001 From: bboysoul <31786046+bboysoulcn@users.noreply.github.com> Date: Tue, 29 Jun 2021 11:14:36 +0800 Subject: [PATCH] Update https.go --- server/proxy/https.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/proxy/https.go b/server/proxy/https.go index 863050f..6eed7d4 100644 --- a/server/proxy/https.go +++ b/server/proxy/https.go @@ -125,8 +125,7 @@ func (https *HttpsServer) handleHttps(c net.Conn) { if targetAddr, err = host.Target.GetRandomTarget(); err != nil { logs.Warn(err.Error()) } - r.Header.Set("X-Forwarded-For", c.RemoteAddr().String()) - r.Header.Set("X-Real-IP", c.RemoteAddr().String()) + logs.Trace("new https connection,clientId %d,host %s,remote address %s", host.Client.Id, r.Host, c.RemoteAddr().String()) https.DealClient(conn.NewConn(c), host.Client, targetAddr, rb, common.CONN_TCP, nil, host.Flow, host.Target.LocalProxy) } @@ -184,5 +183,7 @@ func buildHttpsRequest(hostName string) *http.Request { r.URL = new(url.URL) r.URL.Scheme = "https" r.Host = hostName + r.Header.Set("X-Forwarded-For", c.RemoteAddr().String()) + r.Header.Set("X-Real-IP", c.RemoteAddr().String()) return r }