I am experiencing intermittent Cloudflare Error 520 (Web server returned an unknown error) across multiple websites hosted on the same Windows Server running IIS 10.
Environment
Windows Server with IIS 10
Multiple websites hosted on the same server
All affected domains are proxied through Cloudflare
Websites use a mix of ASP.NET / ASP.NET Core and other web technologies
All affected domains point to the same origin server
Cloudflare reports Browser Working, Cloudflare Working, but Host Error.
Problem description
The issue is intermittent and seems to follow this pattern:
A website remains idle for some time.
The first request after the idle period sometimes returns Cloudflare Error 520.
Refreshing the page immediately usually works.
After another idle period, the first request may fail again.
The same behavior has been observed across multiple domains hosted on the same origin server.
This makes me suspect a shared origin-level issue rather than an application-specific problem.
Troubleshooting already performed
1. Cloudflare
Disabled HTTP/2 to Origin temporarily for one affected domain.
The issue persisted.
Other Cloudflare settings have not been changed during the investigation.
2. IIS and HTTP.sys
IIS keep-alive is enabled.
Checked HTTP.sys service state and request queues.
No consistent evidence of application request queue saturation.
HTTP.sys global timeouts:
Idle Connection Timeout: 120 seconds
Header Wait Timeout: 120 seconds
3. Server resources
The server has 48 GB RAM, with approximately 30 GB available during testing.
Performance counter samples showed:
CPU usage: approximately 1–3%
Available memory: approximately 30 GB
Disk latency: approximately 1.2 ms
There was no obvious CPU, RAM, or disk bottleneck during these samples.
4. Network and TCP diagnostics
Primary network adapter showed zero received/outbound errors and discards in the sampled counters.
TCP statistics showed cumulative connection resets and retransmissions, but no confirmed correlation with the 520 errors.
Multiple established connections from Cloudflare IP ranges were visible on port 80.
5. HTTPERR logs
I found entries including:
Timer_ConnectionIdleTimer_HeaderWaitTimer_MinBytesPerSecondConnection_DroppedConnection_Dropped_List_Full
Some entries involve requests from Cloudflare IP ranges. However, I have not established a direct timestamp correlation between these entries and a specific 520 response.
What I am trying to understand
Since multiple websites on the same origin experience the same intermittent behavior, I would like to investigate the common infrastructure layer.
Could this be related to any of the following?
HTTP.sys connection lifecycle or keep-alive handling
TCP connection reuse between Cloudflare and IIS
Windows HTTP service timeout behavior
Firewall, NAT, or network connection tracking
Hosting provider network or hypervisor-level networking
Cloudflare-to-origin connection handling
My main questions:
What is the best way to identify whether Cloudflare is receiving an invalid response, an abruptly closed connection, or no response from the origin?
How can I correlate a Cloudflare 520 occurrence with Windows HTTP.sys, IIS, and TCP-level diagnostics?
Are there any specific Windows Server logs or counters that can help identify this type of intermittent connection issue?
Is there a reliable way to capture the TCP handshake and connection lifecycle during the failure?
I would prefer to identify the actual root cause before changing HTTP.sys timeouts, IIS settings, or firewall configuration.
Any suggestions for further diagnostics would be appreciated.