CloudFlare 522 and HAproxy

Hello,

We use schema:

CloudFlare → HAProxy v.2.4.8 → Nginx-> Tomcat → Application

Sometimes we see error 522 with our clients. Connection cannot be established. From the CF logs it is clear that the connection breaks for 15 seconds https://support.cloudflare.com/hc/en-us/articles/115003011431-Troubleshooting-Cloudflare-5XX-errors#522error

  1. Before a connection is established, the origin web server does not return a SYN+ACK to Cloudflare within 15 seconds of CloudFlare sending a SYN.

What logging for haproxy can be enabled to determine the cause. Is it internet packet loss or something else?

Thanks

Why do you have an nginx server in the mix? I’d move that out the way and try again. I have an Apache Guacamole setup like this where the traffic flows like:

Cloudflare → HAProxy → Tomcat → Application

It works perfectly.

It was built before me. I don’t have an answer to that question. But your experience is interesting. We have this problem mainly from India. I suppose that sometimes for some reason the handshake becomes very slow.