Preface / Hook

2 a.m., the deploy dashboard is solid red, three rollbacks and still 502. The logs show one line: upstream timeout. Nobody knows which layer broke — CDN, gateway, or origin. The core argument: an HTTP status code is the server's contract receipt, not decoration. One 301 that isn't followed to the end, one 200 that is really a soft 404, and a routine release becomes an incident. This piece covers 5 dimensions and 3 tools you can use today to turn "glance at the status code" into a repeatable triage flow.

1. Source control: don't let bad status codes reach production

1.1 Assert status before you ship

Turning "the homepage and key endpoints must return 200" into a pipeline assertion beats clicking through by hand.

// ❌ Wrong: only checking the build
npm run build && deploy

// ✅ Right: assert key routes after deploy
for path in / /pricing /api/health; do
  code=$(curl -s -o /dev/null -w "%{http_code}" https://example.com$path)
  [ "$code" = "200" ] || { echo "❌ $path -> $code"; exit 1; }
done

Toolchain:

  • Dev: browser DevTools Network panel — read the Status column
  • CI/CD: curl -w "%{http_code}" or newman; block merge on non-2xx
  • Runtime: gateway health probe /healthz must return 200

1.2 Tell a real 200 from a soft 404

Many SPAs return 200 + an empty page for unknown routes. Search engines read that as a soft 404 and dilute your crawl budget.

// Soft 404 signature: 200 but empty/error body
GET /no-such-page  ->  200  (body: "Not Found")
// Correct: return a real 404
GET /no-such-page  ->  404

Watch out: static sites need a real 404.html served with a 404; APIs should return 404, not 200 with an error field.

2. Toolchain: from manual curl to scheduled sweeps

2.1 Local dev: one curl line

# status only
curl -s -o /dev/null -w "%{http_code}\n" https://example.com
# status + redirect chain + timing
curl -sIL -w "final:%{http_code} time:%{time_total}s\n" https://example.com

2.2 CLI batch

# check a list, print status
cat urls.txt | while read u; do
  echo "$(curl -s -o /dev/null -w '%{http_code}' "$u")  $u"
done
# only non-2xx
cat urls.txt | while read u; do
  c=$(curl -s -o /dev/null -w '%{http_code}' "$u")
  [ "${c:0:1}" = "2" ] || echo "$c  $u"
done

Big lists (1000+): use xargs -P for concurrency instead of serial checks.

# 20-way concurrent check
cat urls.txt | xargs -P20 -I{} sh -c 'echo "$(curl -s -o /dev/null -w "%{http_code}" "{}")  {}"'
# or use the on-site batch tool
# 👉 HTTP Status Batch Checker — paste a whole batch, run concurrently, export the non-2xx list

2.3 Online debugging

Pain pointSolution
Installing curl / writing scriptsOpen a page, zero install
Following multi-hop redirectsAuto-expand the full 301→302→200 chain
Internal URLs you won't send outPure client-side requests, never via our server

3. Cleaning dirty data: the "fake moves" in status codes

3.1 Typical misleading patterns

PatternWhat it really meansHarmFix
Long 301 chainhttp→https→www→/ multi-hopLink equity loss, slowerCollapse to one hop
200 soft 404Missing content still 200Flagged duplicate/thinReturn real 404
403 vs 401401 not logged in / 403 no permissionBroken front-end handlingSeparate by semantics
429 rate limitHit a rate limitMisread as an outageBack off and retry
5xx sporadicOrigin/gateway errorAvailability dropCheck if it clusters on one node

3.2 One-shot sweep script

// check.js — batch fetch and classify
const urls = process.argv.slice(2);
const check = async (u) => {
  try {
    const r = await fetch(u, { redirect: 'manual' });
    return { u, code: r.status };
  } catch (e) { return { u, code: 'ERR' }; }
};
Promise.all(urls.map(check)).then(rs => {
  rs.filter(r => String(r.code)[0] !== '2')
    .forEach(r => console.log(r.code, r.u));
});

3.3 Encoding / redirect checklist

  1. Confirm the Location header points at the final 200 address
  2. Check whether http/https and www/non-www each add a hop (should be merged)
  3. Is the CDN caching a 404 as a 200?
  4. Did a terminal/proxy inject an extra redirect?

Quick verify:

curl -sIL https://example.com | grep -iE "^(HTTP|location)"
# one HTTP/... line per hop; the last is the final state

4. Performance and security

4.1 Don't kill the target with concurrency

// ❌ Wrong: unbounded concurrency
urls.forEach(u => fetch(u));

// ✅ Right: limit concurrency + timeout
const pool = (await import('p-limit')).default;
const limit = pool(10);
await Promise.all(urls.map(u => limit(() =>
  fetch(u, { signal: AbortSignal.timeout(5000) })
)));

Production metric: sweeping 1000 URLs at concurrency 10 with a 5s timeout keeps total time bounded and avoids triggering the target's 429.

4.2 Security notes

// Don't send internal/sensitive URLs to third-party online services
// This site's tools are pure client-side; URLs are never stored
const safeCheck = (u) => {
  const host = new URL(u).hostname;
  if (host === 'localhost' || host.endsWith('.internal')) return 'skip';
  return fetch(u, { redirect: 'follow' }).then(r => r.status);
};

5. Team workflow

5.1 Hang the sweep in CI

# .github/workflows/status.yml
- name: Smoke check
  run: |
    for p in / /api/health; do
      c=$(curl -s -o /dev/null -w "%{http_code}" $BASE_URL$p)
      [ "$c" = "200" ] || { echo "$p -> $c"; exit 1; }
    done

5.2 PR checklist

## HTTP status checks
- [ ] New/changed routes return correct codes (2xx/4xx/5xx semantics)
- [ ] No soft 404 (missing returns 404)
- [ ] Redirect chain is one hop or fewer
- [ ] Errors use 4xx/5xx, not 200 + error
- [ ] Rate-limited endpoints return 429 + Retry-After

6. Tool table

ScenarioToolKey advantage
Single URL lookupOn-site HTTP Status CheckerFull redirect chain, timing, zero install
Batch sweepOn-site HTTP Status BatchPaste a batch, concurrent, export non-2xx
Dead link scanOn-site Broken Link CheckerScan a page, list every 4xx/5xx link
Terminalcurl -sILScript-friendly, pipeable
DNS/port sideDNS LookupRule out DNS before blaming the server

7. Pitfalls summary

  1. Assert status in CI — auto-check key routes return 200 after deploy
  2. Kill soft 404 — missing means a real 404, don't fake 200
  3. Collapse redirects — squeeze the chain to one hop
  4. Read 4xx semantics — 401 not logged in, 403 no permission, 429 rate limit
  5. Limit concurrency — cap concurrency + timeout on batch sweeps
  6. Keep URLs local — use client-side tools for internal addresses
  7. Check the chain — read the full redirect chain, not just the first hop

Closing Thoughts

Checking HTTP status looks like "reading a number," but it is really confirming the server kept its contract.
Make status assertions, chain checks, and batch sweeps into infrastructure — wired into CI, release flow, and alerting.
Next time you get paged at 2 a.m., it won't be because of "one 302 nobody followed to the end."