Everything green in the dashboard. Users see BAD GATEWAY.

Solved502nginxreverse-proxy3 replies Β· 63 views Β· started
Accepted solution by Tess Celik β€” ok so start with teh nginx error log, it tells u which kind of 502 it is: [code] connect() failed (111: Connection refused) means nothing…
  1. ugh. this one is driving me crazy. after a reboot, a chunk of requests fail with this page:

    502 Bad Gateway

    502 Bad Gateway
    nginx
    

    not all of them, maybe one in ten πŸ‘ the Spring Boot app health check is green the whole time. my manager asked if we 'turned it off and on again' πŸ˜‚ we did 🀦 several times.

    load is not crazy, a few hundred requests a minute at peak... id realy like to understand what nginx is complaining about before i start randomly changing timeouts and buffer sizes and make things worse.

    4
  2. Accepted solution

    ok so start with teh nginx error log, it tells u which kind of 502 it is:

    sudo tail -f /var/log/nginx/error.log
    

    connect() failed (111: Connection refused) means nothing listens where proxy_pass points. upstream prematurely closed connection means teh app accepted and then dropped teh request. no live upstreams means all backends were marked down.

    thinking

    1 5 helpful
  3. @tessc705 holy cow changed proxy_pass from localhost to 127.0.0.1:9000.. πŸ˜… nginx was trying IPv6 first and teh app only listened on IPv4... zero 502s since.

    0 9 helpful

Reply to this topic

Sign in or create an account to reply.