Diagnosing website downtime
Before a page appears, the browser looks up the domain in DNS, opens a connection to the address it gets back, checks the server's certificate, and receives a page produced by the application, often through a CDN or reverse proxy. A site is down when one of these stages fails and the request gets no usable answer. Visitors see the same broken page whichever stage failed, but each stage fails with its own error, or with none, and that difference locates the fault.
First check from outside
Run the check from a computer other than the server, so that the result reflects what visitors get:
curl -s -o /dev/null -w "%{http_code} %{time_total}\n" https://example.comThe command discards the page and prints the HTTP status code and the total time in seconds.1 A code from 500 to 599 means a server answered with an error; Table 1 lists the common ones. When no HTTP answer arrives at all, the failure lies earlier, in DNS, the connection or the certificate.
Reading the status code
| Code | Meaning |
|---|---|
| 500 Internal Server Error | The application hit a condition it could not handle and found no more specific code. Its own error log has the cause. |
| 502 Bad Gateway | A proxy or gateway reached the application and got an invalid response back. |
| 503 Service Unavailable | The server is not ready, usually because of maintenance or overload. Meant for temporary conditions. |
| 504 Gateway Timeout | A proxy or gateway waited for the application and got no response in time. |
| 521 (Cloudflare) | The origin server refused Cloudflare's connection. |
| 522 (Cloudflare) | Cloudflare timed out while connecting to the origin server. |
| 525, 526 (Cloudflare) | The TLS handshake with the origin failed, or the origin's certificate is invalid. |
The first four codes are defined for HTTP in general.2 A 502 or 504 means the proxy in front is working and the application behind it has stopped or is too slow. Codes 520 to 526 come from Cloudflare itself: Cloudflare is answering, and the fault is between Cloudflare and the origin server.3 The two most common causes of a 521 are an application on the origin that is not running and a firewall that blocks Cloudflare's addresses.4 Cloudflare returns a 522 when the origin sends no reply to a connection attempt within 19 seconds, or no data within 90 seconds after connecting. One listed cause is an origin address in the Cloudflare DNS settings that no longer matches the address the host gives the server, as happens after a server is replaced.5 An overloaded origin also produces 503 and 522 answers, including overload from a denial-of-service attack.
DNS and the domain
dig example.comThe answer should list the address of the server, and that address should match the one the hosting provider shows. A status of SERVFAIL means the resolver could not get an answer from the domain's nameservers, and the browser then shows an error.6
An expired domain stops resolving before it is lost. Under ICANN's Expired Registration Recovery Policy, a registrar must interrupt the DNS service of an expired domain for up to eight days before deleting it, and the website and email stop working during that time. The registrar sends reminders about a month and about a week before expiry, to the registrant email in the domain's contact details, so an outdated address means the reminders go unread. After deletion, registries of generic top-level domains keep a 30-day Redemption Grace Period in which the holder can restore the domain through the registrar, which may charge a fee.7
Certificate
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
| openssl x509 -noout -enddateThe first command opens a TLS connection to the server.8 The second prints the certificate's expiry date, its notAfter field. With -checkend 604800 in place of -enddate, the command exits with a non-zero status when the certificate expires within the next 604,800 seconds (seven days), which a scheduled script can test.9
Let's Encrypt certificates are valid for 90 days by default, with renewal recommended every 60 days.10 It stopped sending expiry reminder emails on 4 June 2025, citing the spread of automated renewal, and points subscribers to separate monitoring services for those reminders. A renewal job that stops working therefore gets no warning from Let's Encrypt itself.11 Encryption in transit covers how certificates work.
Notable incident
On 4 October 2021, Facebook, Instagram and WhatsApp were unreachable for about five and a half hours. During routine maintenance, a command meant to assess how much capacity was available on Meta's backbone network disconnected all of its data centers, and a bug in the audit tool that should have blocked the command let it through. Meta's DNS servers are built to withdraw their BGP route announcements when they cannot reach the data centers, so they kept running while no other network could reach them.12 Cloudflare saw a burst of routing changes from Facebook at about 15:40 UTC. Public resolvers, including 1.1.1.1 and 8.8.8.8, answered SERVFAIL for facebook.com, and the name resolved again on 1.1.1.1 at about 21:20 UTC. The failing DNS was the first symptom of a wider network outage, and retries from apps and users multiplied the DNS traffic in the meantime.6 The loss of DNS also broke Meta's internal tools, so engineers went to the data centers in person, and services were turned back on in stages to avoid a second failure from the surge of traffic.12
Preventing a repeat
Keep the registrant email of every domain current, since the registrar's expiry reminders go only to that address.7 Renew certificates automatically on the 60-day schedule and watch their expiry from a separate service.1011 When the site runs behind Cloudflare, update the origin address in the Cloudflare DNS settings whenever the server's address changes, and allow Cloudflare's address ranges in the origin's firewall.45
In SecFlash
SecFlash reports SF-UPT-101 on the Uptime page when three checks in a row get no answer or an error status. It reports a certificate that expires soon as SF-SEC-205 and an invalid one as SF-SEC-204 on the Security page, and a domain close to expiry as SF-EML-201 on the Email and domain page. On the server it is installed on, the Server page shows conditions that can stop an application from answering: SF-SRV-601 for a disk that is nearly full, SF-SRV-602 and SF-SRV-603 for memory that is running out or has run out, SF-SRV-405 for containers that keep restarting and SF-SRV-406 for containers stopped for using too much memory.
See also
- Denial-of-service attack
- Encryption in transit
- Backup and restore
- Responding to unauthorised changes to a website
- Security maintenance after launch
- Category: Incident response
References
- back "curl man page". curl.se.
- back "HTTP response status codes". MDN Web Docs. Mozilla.
- back "Cloudflare 5xx errors". Cloudflare Support docs. Cloudflare.
- a b "Error 521". Cloudflare Support docs. Cloudflare.
- a b "Error 522". Cloudflare Support docs. Cloudflare.
- a b (4 October 2021). "Understanding how Facebook disappeared from the Internet". The Cloudflare Blog. Cloudflare.
- a b "5 Things every Domain Name Registrant should know about ICANN's Expired Registration Recovery Policy (ERRP)". icann.org. ICANN.
- back "openssl-s_client". OpenSSL 3.0 documentation. OpenSSL Project.
- back "openssl-x509". OpenSSL 3.0 documentation. OpenSSL Project.
- a b "FAQ". Let's Encrypt. Internet Security Research Group.
- a b Aas, Josh (22 January 2025). "Ending Support for Expiration Notification Emails". Let's Encrypt.
- a b Janardhan, Santosh (5 October 2021). "More details about the October 4 outage". Engineering at Meta.
External links
- Expired Registration Recovery Policy, ICANN
- Cloudflare 5xx errors, Cloudflare Support docs