Intermittent 502 errors routing GA4 events to self-hosted sGTM

Hi everyone, I am currently testing a local staging environment for server-side GTM on an edge mini-PC before migrating the container over to a managed Stape hosting plan. I followed a Linux deployment guide, flashed Debian using the disk imaging utility referenced on that website, and spun up the standard sGTM Docker image with our custom tagging URL.

Everything looks healthy internally, but when sending test events from our production website through a Cloudflare proxy, we encounter intermittent 502 Bad Gateway responses. The container logs show that the GA4 client occasionally drops incoming requests whenever multiple concurrent hits arrive, even though the CPU and memory usage remain well below critical thresholds.

Has anyone seen this kind of proxy handshake failure or header drop when running local Docker setups? I would appreciate any insight into recommended Cloudflare SSL settings or specific container environment variables required to keep the connection persistent.

Hi,
Unfortunately, it’s difficult for us at Stape to determine the exact cause of the problem, first and foremost, it is necessary to pinpoint the cause of the problem.

Alternatively, you can try switching to Stape right now and test everything out.

We hope that someone from the community will also be able to share some helpful information.

One thing worth checking: is Cloudflare’s SSL mode set to Full (strict) with a valid origin cert, and are the 502s correlated with bursts of concurrent hits? Checking whether the container’s reverse proxy or Docker host is hitting connection or keep-alive limits could help narrow it down.