We're experiencing intermittent 522 errors on various resources with SSL/TLS enabled

Hello, Community,

We've spent several days debugging this issue ourselves with no success. We’re working with a very simple setup:

Nginx configuration with a server-side Cloudflare certificate installed

All relevant keep-alive and performance settings enabled

We have only one location block:


location /test/ { rewrite ^/test/.*$ /header.js break; root /usr/local/tomcat/webapps/ROOT/javascript; }

The issue:
During a load test with 50 simultaneous connections, everything works perfectly in DNS-only mode.
However, when switching to Proxied mode with SSL/TLS enabled, we intermittently get 522 errors.

It appears to match the behavior described in this post:

https://community.cloudflare.com/t/random-522-error-or-20-seconds-timeout-but-no-issue-on-direct-ip-access/700318

We've verified:
  • System file descriptor limits are set to maximum
  • Disk I/O is not a bottleneck
  • The server has 32 GB RAM and an 8-core CPU — so resource limits aren’t an issue
  • CPU load is low
  • HTTP/2 is enabled
  • SSL caching is active
Does anyone have ideas on what could be causing this?
Any insights would be highly appreciated.
image.png
Was this page helpful?