Website returns 200 but shows error? How to catch soft errors
A status code only tells you the server answered. It does not tell you what the page says. Here is how to confirm a page is broken even though it returns 200, and how to alert on it.
Updated
Short answer
The server, a proxy or the framework is returning 200 with an error page in the body, so a status-code check passes. Fetch the page with curl -s and grep for the text you expect, then set up a keyword monitor that alerts when that text is missing or an error string appears.
Why a 200 can still be a broken page
The status code is set by whatever answers the request, and that is not always the part that failed. A proxy, CDN or error handler can return its own page with a 200. Often the application catches an exception, renders an error template, and nobody changed the status. These are called soft errors, and a monitor that only checks the status code reports them as up.
| What the visitor sees | Typical cause | Why it returns 200 |
|---|---|---|
| "Error establishing a database connection" or a stack trace | Database down or out of connections | The app catches the error and renders a message without setting a 5xx status |
| Blank white page | Fatal error with display turned off, or a crashed template | Output is empty but the response was sent successfully |
| "Down for maintenance" | Maintenance mode left on after a deploy | The maintenance page is served with 200 instead of 503 |
| Login or consent wall instead of the page | Expired session config, misrouted rule, bot protection | The redirect or challenge page is itself a valid response |
| Host or CDN default page ("Welcome to nginx", "Domain parked") | Wrong origin, deleted site, DNS pointing at the wrong server | The default server answers normally |
Check it with curl and grep
Fetch the body and search for a phrase that only appears on a healthy page, such as a heading or a product name. -s hides the progress bar, -i on grep ignores case, and -q makes grep print nothing and just set the exit code.
curl -s https://example.com/ | grep -qi "Welcome to Example" && echo OK || echo MISSINGThen search for text that should never be there:
curl -s https://example.com/ | grep -iE "database error|fatal error|maintenance|stack trace"To see the status and the timing in one line, ask curl to print them and discard the body:
curl -s -o /dev/null -w '%{http_code} %{time_total}s\n' https://example.com/What to check for
Use both directions. Expected text catches a blank page, a parked domain and a login wall, because the real content is simply absent. Forbidden text catches a known error message even when the rest of the page still renders.
- Expected: a heading, the site name in the footer, or a string in an API response such as
"status":"ok". - Forbidden: the exact wording your stack uses for database errors, maintenance mode and fatal errors.
- Be specific:
Database connection timeoutis safer thanerror, which can appear in a script or a nav label.
Add a response-time check as well. A page that technically loads but takes 20 seconds is often the first symptom of the same database problem.
Set it up in UptimeIO
- Create a monitor and choose the Keyword type.
- Enter the page URL, then the interval and timeout as for an HTTP monitor.
- In Keyword Configuration, add the expected text as Contains and error strings as Excludes.
- Turn on Slow Response Alert under SSL, domain & performance alerts and set a threshold.
- Choose where alerts go: email, Slack, Telegram, Pushover or a webhook.
How the matching behaves:
- Contains / Excludes: Contains fails the check when the text is missing. Excludes fails it when the text is present.
- Several keywords: up to 20, each up to 500 characters. Match all (default) or Match any applies to the Contains keywords. Any Excludes keyword that appears fails the check.
- Case: off by default, so
erroralso matchesError. Turn on Case sensitive to match exactly. - Plain text only: regular expressions are not supported, so add one keyword per phrase.
- Body only: response headers are not searched, and
HEADrequests cannot be used because they have no body. - Status code: checked first. Only
200passes unless you change Expected Status. - Slow responses: the threshold is 100 to 30,000 ms. A slow response opens a separate incident, and the monitor can be up while it is open.
Test your keywords against the page source first, using the curl commands above. If the monitor reports a keyword missing that you can see in the browser, the text is probably added by JavaScript, or the server sends a different page depending on cookies or user agent.
Questions
- Why does my website return 200 but show an error?
- Because the thing that produced the error page did not change the status code. An application error handler, a maintenance plugin, a CDN or a default server page can all send a 200 with the wrong content.
- Can uptime monitoring detect a blank page?
- Only if it checks content. A keyword monitor with a Contains keyword for something on the real page fails when the body is empty or different.
- Is keyword matching case sensitive?
- Not by default in UptimeIO. `error` matches `Error` and `ERROR`. There is a Case sensitive switch that applies to all keywords on the monitor.
- Can I use regular expressions?
- No. Matching is plain text, so add a separate keyword for each phrase you want to look for.
- Will it see content that JavaScript adds after the page loads?
- No. The monitor searches the response body the server returns. Pick text that is in the initial HTML, or monitor an API endpoint the page depends on.
Related
- Website monitoring - Uptime, response time and alerting for websites.
- Keyword monitoring docs - Every keyword setting, matching rules and troubleshooting.
- HTTP monitoring docs - Request options, expected status codes and slow response alerts.
- DNS not resolving - Diagnose NXDOMAIN and DNS changes that did not take effect.