Learning objectives
After reading this article you will be able to:
- Tell your own outage apart from a network or visitor problem
- Read DNS, TLS and 5xx errors and know the cause behind each
- Follow a diagnostic order and prevent the next outage
When a site goes down, the temptation is to restart everything and hope. It sometimes works, but you learn nothing and the problem returns. It is faster to find where the request breaks.
A visit passes through steps in order: the browser resolves the name through DNS, opens a secure connection using the TLS certificate, reaches a server or proxy, and finally your application answers. Each step fails in a recognizable way. The error you see tells you which one failed.
Is the site really down, or is it just me?#
Before touching the server, confirm the scope. Three one-minute tests:
- Open the site on your phone's mobile data, off Wi-Fi.
- Run
curlfrom another machine or a server. - Ask someone else to open it.
If it loads elsewhere, the problem is local: a stale DNS cache, a VPN, antivirus, a browser extension or your ISP. Flush the cache with ipconfig /flushdns (Windows) or sudo resolvectl flush-caches (Linux with systemd).
If it fails everywhere, the problem is on the site's side. Move on to the next step.
How do I read the error?#
curl shows where the request stopped more clearly than a browser does:
curl -sS -o /dev/null -w "%{http_code}\n" -v https://yoursite.com| What you see | Layer | Likely cause |
|---|---|---|
DNS_PROBE_FINISHED_NXDOMAIN or Could not resolve host |
DNS | Expired domain, deleted record or a typo |
NET::ERR_CERT_DATE_INVALID |
TLS | Expired certificate |
ERR_CONNECTION_REFUSED or timed out |
Network/server | Application stopped, wrong port or firewall |
502, 503, 504 |
Proxy | Application down, overloaded or slow |
500 |
Application | Exception in your code |
404 on every page |
Application | Deploy missing the files or wrong root |
Is DNS resolving the domain?#
Test with:
nslookup yoursite.com
dig +short yoursite.comIf no IP comes back, check two things. First, whether the domain expired at the registrar: it is the most mundane cause and one of the most common. Then whether the A or CNAME record still exists. More in DNS_PROBE_FINISHED_NXDOMAIN and DNS propagation.
If you just changed DNS, results may differ for a while: different resolvers keep the old value until the TTL runs out.
Did the certificate expire?#
Let's Encrypt certificates are short-lived, and the official FAQ recommends renewing them well before they expire. In December 2025, Let's Encrypt announced a gradual reduction of the default lifetime, so renewal has to be automatic. If automatic renewal fails silently (a stopped cron job, port 80 blocked, DNS changed), the site "goes down" with an expired certificate warning.
echo | openssl s_client -connect yoursite.com:443 -servername yoursite.com 2>/dev/null | openssl x509 -noout -datesThe notAfter line is the expiry date. More in SSL certificate errors and how Let's Encrypt works.
What do 502, 503 and 504 mean?#
These are the scariest errors, and all of them point at the application behind a reverse proxy:
- 502 Bad Gateway: the proxy talked to the application and got an invalid response, for example because the process crashed during the request or is not listening where the proxy expects.
- 503 Service Unavailable: the server cannot handle the request right now, because of overload or maintenance.
- 504 Gateway Timeout: the proxy got no response from the application in time.
In all three cases, go to the application log. Look for out-of-memory (Killed, JavaScript heap out of memory, MemoryError), an unhandled exception at startup, or the wrong port. A Node.js server must listen on the port and address the proxy expects:
import http from "node:http";
const port = Number(process.env.PORT) || 3000;
http
.createServer((req, res) => res.end("ok"))
.listen(port, "0.0.0.0", () => console.log(`listening on port ${port}`));Listening only on 127.0.0.1, or on a port the proxy does not know about, produces a 502 even though the application is "running".
What if it is a 500 error or a blank page?#
Here the server is up and your code broke. Check the log at the time of the error and compare with your last deploy. Frequent causes: an environment variable that exists on your machine but not on the server, a dependency that was not installed, a database refusing connections, and a file missing from the deploy. If it started right after publishing, roll back to the previous version first and investigate afterwards.
How do I prevent the next outage?#
- Turn on automatic domain renewal and check the registrar's contact email.
- Use an external monitor that tests the URL every few minutes and notifies you by email, SMS or webhook.
- Keep logs and watch memory and CPU, so you see the limit approaching before it is hit.
- Make sure the application restarts on its own when the process fails.
- Keep a rollback path to the previous deploy.
- If the site does not need server-side code, consider a static site: fewer parts can break.
How to do this on Square Cloud#
On Square Cloud, your site runs in an isolated container that is always on; with automatic restart on (the default for dashboard deploys), an application that exits with an error comes back by itself. You see live logs in the dashboard, the CLI and VS Code. CPU, RAM and network metrics, collected every 5 minutes and kept for 24 hours, show whether memory ran out before the crash. Running out of memory stops the application, and it stays stopped until you raise its RAM and start it again.
Every web application gets a *.squareweb.app subdomain with HTTPS, which helps separate a domain problem from an application problem: if the subdomain opens and your domain does not, the fault is on the domain side (DNS records or the domain itself), not in the application. On a custom domain (from the Standard plan), the dashboard shows DNS record validation status in real time, and TLS is automatic.
Web analytics, included in every plan, shows visits, routes and status codes; Pro and Enterprise add HTTP logs. There are no email alerts, so use an external monitor to get notified.
To get started, see the site hosting page; monitoring details are on the analytics page.
Website hosting
Static and SSR sites with automatic TLS and a global CDN
FAQs
How do I know if my site is down for everyone or just me?
Test from another network (such as your phone's mobile data) and run curl from another machine. If it loads there but not on your computer, the problem is local: DNS cache, VPN, firewall or a browser extension.
What does a 502 or 504 error mean?
Both are gateway errors. A 502 means the proxy got an invalid response from the application behind it. A 504 means the proxy got no response in time. Usually the application crashed, hung or is too slow.
Why did my site go down when I didn't change anything?
Common causes with no change on your side: an expired certificate, an expired domain, out-of-memory, a full disk, a third-party dependency being down, or an automatic deploy with a bug.
How long until the site is back after I fix it?
If the fault was in the application, it is back as soon as it restarts. If it was DNS, it can take minutes to hours because resolvers cache the old answer.
More in Websites
See all 20 articles- What is a static site (and how to host one)A static site is a set of ready-made HTML, CSS and JavaScript files served the same to every visitor. Learn how it works, when to use one and how to host it.
- How much does it cost to host a website?Hosting a website costs anywhere from nothing to a few dozen dollars a month. See what goes into the bill: hosting, domain, traffic and extras, with real limits.
- How much does static site hosting cost?Hosting a static site costs between zero and a few dozen dollars a month in most cases. See how traffic sets the price, with step-by-step math.
- How much does it cost to host a Next.js app?Hosting a Next.js app costs from zero with a static export to tens of dollars a month with a server. See the billing models, traffic math and hidden costs.