Fix readHeaderTimeout in proxyproto

This commit is contained in:
Julien Salleyron 2024-01-02 22:02:05 +01:00 committed by GitHub
parent 5be13802dc
commit 56e2110dc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -418,7 +418,12 @@ func (ln tcpKeepAliveListener) Accept() (net.Conn, error) {
}
func buildProxyProtocolListener(ctx context.Context, entryPoint *static.EntryPoint, listener net.Listener) (net.Listener, error) {
proxyListener := &proxyproto.Listener{Listener: listener}
timeout := entryPoint.Transport.RespondingTimeouts.ReadTimeout
// proxyproto use 200ms if ReadHeaderTimeout is set to 0 and not no timeout
if timeout == 0 {
timeout = -1
}
proxyListener := &proxyproto.Listener{Listener: listener, ReadHeaderTimeout: time.Duration(timeout)}
if entryPoint.ProxyProtocol.Insecure {
log.FromContext(ctx).Infof("Enabling ProxyProtocol without trusted IPs: Insecure")