支持PROXY Protocol

This commit is contained in:
GoEdgeLab
2021-10-12 20:18:02 +08:00
parent 14cf334d2c
commit be56cefd08
4 changed files with 99 additions and 56 deletions

View File

@@ -41,6 +41,8 @@ type ReverseProxyConfig struct {
AutoFlush bool `yaml:"autoFlush" json:"autoFlush"` // 是否自动刷新缓冲区在比如SSEserver-sent events场景下很有用
ProxyProtocol *ProxyProtocolConfig `yaml:"proxyProtocol" json:"proxyProtocol"`
requestHostHasVariables bool
requestURIHasVariables bool
@@ -171,6 +173,14 @@ func (this *ReverseProxyConfig) Init() error {
this.addXForwardedProtoHeader = lists.ContainsString(this.AddHeaders, "X-Forwarded-Proto")
}
// PROXY Protocol
if this.ProxyProtocol != nil {
err := this.ProxyProtocol.Init()
if err != nil {
return err
}
}
return nil
}