Cloudflare 522 origin timeout investigation cheat sheet
Investigate Cloudflare 522 origin connection timeouts using response headers and origin-side evidence.
Cloudflare proxied HTTP or HTTPS application with access to the zone and origin service; this does not cover Spectrum-specific status semantics.
Updated · Cloudflare · 6 min read
| Command | What it does |
|---|---|
curl -sS -D - -o /dev/null https://example.com/ | Capture the response headers |
curl -sS -o /dev/null -w "%{http_code} %{time_connect} %{time_total}\n" https://example.com/ | Measure an edge request |
ss -ltn | Inspect origin listening sockets |
systemctl status nginx --no-pager | Inspect the origin service status |
journalctl -u nginx --since "30 minutes ago" --no-pager | Review recent service logs |
Walkthrough
Replace example.com with an authorized hostname. Commands send HTTPS requests; inspect origin configuration only with the owner and never expose an origin address publicly.
Step 1: Capture the response headers
curl -sS -D - -o /dev/null https://example.com/
Run against the affected authorized hostname and record the HTTP status, timestamp and any Cloudflare Ray ID. Protect cookies or other sensitive headers if your environment returns them.
Step 2: Measure an edge request
curl -sS -o /dev/null -w "%{http_code} %{time_connect} %{time_total}\n" https://example.com/
Record the response code and timings from the client to Cloudflare. These client-side timings do not directly measure the connection from Cloudflare to the origin.
Step 3: Inspect origin listening sockets
ss -ltn
On the authorized Linux origin, verify that the intended service is listening on the expected address and port. A listening socket does not establish that Cloudflare can reach it.
Step 4: Inspect the origin service status
systemctl status nginx --no-pager
On an NGINX system, check the service state and recent messages; substitute the actual service name where appropriate. A running service can still be overloaded or unreachable.
Step 5: Review recent service logs
journalctl -u nginx --since "30 minutes ago" --no-pager
On an NGINX system with journal logging, compare relevant timestamps with the incident. Missing origin logs do not exclude a network or firewall drop before requests arrive.
WORKED INCIDENT
Practical case: A proxied site intermittently returns 522
Fictional teaching scenario; observations are examples, not captured production output.
Situation
Visitors report intermittent Cloudflare 522 errors while the origin administrator sees an active web service.
Investigation sequence
1. Capture the response headers
curl -sS -D - -o /dev/null https://example.com/Capture the failing status, time and Ray ID from an authorized client.
2. Measure an edge request
curl -sS -o /dev/null -w "%{http_code} %{time_connect} %{time_total}\n" https://example.com/Record a repeat request and client-side timing without treating it as an origin latency measurement.
3. Inspect origin listening sockets
ss -ltnCheck whether the origin is listening on its configured address and port.
4. Inspect the origin service status
systemctl status nginx --no-pagerCompare service state and origin logs with the incident window.
Example findings
Illustrative findings: the service is listening, while the network team identifies an origin firewall rule dropping some Cloudflare source traffic.
Interpret the findings
The firewall finding explains this example. A running origin and a 522 response alone do not identify whether routing, filtering or origin overload caused the timeout.
Verify the outcome
After the owner applies an approved correction, test through Cloudflare and check that the error rate returns to baseline.
Escalation handoff
Provide the hostname, timestamps, Ray IDs and sanitized origin and firewall evidence to the hosting and network teams.
Primary references
Documented reference; examples above are teaching scenarios. Confirm behavior against your deployed version.