support proxy protocol for type http

This commit is contained in:
fatedier
2019-04-10 10:51:01 +08:00
parent 7f9d88c10a
commit b7a73d3469
5 changed files with 21 additions and 7 deletions

View File

@@ -523,6 +523,9 @@ func HandleTcpWorkConnection(localInfo *config.LocalSvrConf, proxyPlugin plugin.
// check if we need to send proxy protocol info
if baseInfo.ProxyProtocolVersion != "" {
if m.SrcAddr != "" && m.SrcPort != 0 {
if m.DstAddr == "" {
m.DstAddr = "127.0.0.1"
}
h := &pp.Header{
Command: pp.PROXY,
SourceAddress: net.ParseIP(m.SrcAddr),