is it nginx or the spring boot app? a 502 mystery with one clue

Solved502nginxreverse-proxy91 replies · 1.7K views · started
  1. long time lurker first post lol our Spring Boot app sits behind nginx on teh same VM. It listens on 5000. Its been fine for months, but now after a reboot we get this:

    502 Bad Gateway

    502 Bad Gateway
    nginx
    

    if i SSH in and curl localhost:5000 i get a 200 instantly. restarting nginx fixes it for a while, im out of ideas and support tickets are piling up.

    config hasnt changed in ages, as far as I know. the nginx config test passes, the apps own logs look normal, and CPU and memory on teh box are fine. what sohuld I check first so I stop guessing? im about to throw this thing out the window lol

    thinking

    2
  2. ok so if it only happens under load or intermittently, look at keepalive mismatch. If the app closes idle connections sooner than nginx reuses them, u get sporadic 502s ;) Either raise teh apps keep-alive timeout above nginxs, or set proxy_http_version 1.1; with proxy_set_header Connection ""; and a sensible keepalive in teh upstream block. good luck man!

    2 0 helpful
  3. for me it was the firmware. swapepd it and boom, fixed. exact same thing happened to my second monitor setup last month fingers crossed 🤞

    1 0 helpful
  4. on RHEL/Fedora-family systems with SELinux enforcing, nginx is not alolwed to open outbound connections by default. look for Permission denied in the error log and run sudo setsebool -P httpd_can_network_connect 1.

    1 0 helpful
  5. ok weird one spent 20 minutes on reboot and im still not done what am i doing wrong??

    1 0 helpful
  6. long time lurker first post lol my old thinkpad is officially haunted

    0 1 helpful
  7. @buffergarage what did u end up doing in teh end ??

    1 2 helpful
  8. honestly just reset the default config and save yourself teh pain

    1 0 helpful
  9. i swear nginx is cursed pls help 🙏

    facepalm

    11 0 helpful
  10. hmmmm ok told my boss it would take 10 minutes... its been a whole week

    rage

    1 0 helpful
  11. is nginx even worth bothering with or should i just leave it

    1 0 helpful
  12. unrelated but anyone elses coffee machine also judging them today... have u checked your spring settings?? mine were reset after an upadte

    15 0 helpful
  13. ok update: did what @lars_proxy said and its fine now

    mindblown

    2 0 helpful
  14. is reboot even worth bothering with or should i just leave it

    0 2 helpful
  15. same issue here on my moms pc. driving me crazy worked for me anyway 🤷

    2 0 helpful

Reply to this topic

Sign in or create an account to reply.