-
-
Notifications
You must be signed in to change notification settings - Fork 118
Open
Description
I was using this library to build a service that terminates TLS and does IP based blocking using the proxy protocol headers. As far I can tell, wrapping the tls listener inside of proxyproto listener is the wrong order. I'm not sure why the test code works with how it is:
https://github.com/pires/go-proxyproto/blob/main/protocol_test.go#L960
When I did it exactly the way the test does it, curl --haproxy-protocol returns TLS errors and in the code I got tls: first record does not look like a TLS handshake. When I did it this way, it works:
l, _ := net.Listen("tcp", ":8443")
ppl := &proxyproto.Listener{
Listener: l,
Policy: func(upstream net.Addr) (proxyproto.Policy, error) {
return proxyproto.REQUIRE, nil
},
}
...
listener := tls.NewListener(l, &config)
I believe this logically makes since because the proxy protocol header needs to be handled first as the tls library doesn't know how to handle it. Is there something I'm missing?
Aria461863631 and dungman1