502 error when uploading source maps to on premise Sentry with keep alives enabled

We’ve started trying to upload source maps to our on premise Sentry but were getting 502 errors when using the Sentry CLI.

I couldn’t see anything of note in the Sentry logs and it’s not showing the 502 itself in its access logs but I do see the 502 thrown by the AWS application load balancer that sits in front of it. There doesn’t appear to be anything wrong with the application itself and response times are reasonable still so I can’t understand where it’s coming from.

After reading 502 (Generic error) when publishing release using Sentry-CLI and https://github.com/getsentry/sentry-cli/issues/40 we disabled keep alives in the Sentry CLI and it’s now working fine but that seems unintuitive to me and I can’t see why that would help solve the issue in any way. Is there an explanation as to why that would help that I’ve missed? I’m guessing our setup is misconfigured to require these to be disabled but not sure if I’m missing something in the UWSGI config somewhere?

For reference our Sentry install is running in Docker containers in AWS’ ECS with an ALB in front of the application container (and the cron and worker containers running as separate services). We’re running 8.22 and the configuration is basically stock other than setting SENTRY_SECRET_KEY, GOOGLE_CLIENT_SECRET (we’re using the Google OAuth plugin) and a bunch of database/Redis config via environment variables.