I noticed Cloudflare was intermittently returning 502s after I redeployed a backend service that went down for some time. I made some fixes to my backend service and nginx proxy to have keepalive timeouts lower than the idle timeout on my AWS ALB, ordered as backend_timeout (65s) > nginx_timeout (75s) > alb_timeout (80s), and i believe Cloudflare’s is set to 100s by default.
I’m unsure if this is the correct configuration but would really appreciate tips for syncing the timeouts and avoiding a ton of 502s. I’m currently managing by doing retries on the frontend but that’s slower and not super ideal. Any techniques that would at least reduce the current rate of timeout errors (1 every 3-5 requests), that would be super helpful