mholt/caddy-l4

Throw "read: connection reset by peer" when I set "proxy_protocol v1"

Opened this issue · 3 comments

Thank you for the wonderful product. However a error happened when I use it.
My caddyFile like this:

{
      layer4 {
                0.0.0.0:8883 {

                        @secure tls
                        route @secure {
                                tls {
                                }
                                proxy {
                                        proxy_protocol v1
                                        upstream 139.196.153.113:1883
                                }
                        }
                }
        }
}

the error log I received like this

"error": "writeto tcp 172.19.244.221:34178->139.196.153.113:1883: read tcp 172.19.244.221:34178->139.196.153.113:1883: read: connection reset by peer"

I must set 'proxy_protocol' to 'v1', because I want to get the remote real ip.

@xiaoke1256 Are you sure the 139.196.153.113:1883 host understands and expects to receive proxy protocol? Is it a Caddy instance? Then please post its config. Otherwise it's unclear what could be wrong with the config you posted above.

However when I delete the line proxy_protocol v1, it can work.

So it might mean your upstream doesn't expect to receive proxy_protocol v1.