Lesson 2 of 10Foundations

12 min · theory and practice · Basics

HTTP: from request to page

Inspect the status, headers and body. Learn why 200 alone does not guarantee a working website.

You will be able to inspect a server response and separately check browser resource loading.

A browser fetches HTML, then scripts, styles and data. The main document can return 200 while another failed request prevents the application from starting. Follow the path through to the visible result.

Send a normal GET

curl -i shows response headers and the body. -sS hides the progress meter but retains errors, and --max-time bounds the wait. curl -I sends HEAD; start with GET when checking content.

Commands
curl -sS -i --max-time 5 http://localhost:8080/health
Example output
HTTP/1.1 200 OK
Content-Type: application/json

{"status":"ok"}

A health endpoint and the home page test different things. A successful health response does not prove that a user journey works.

Inspect the failing resource

Open DevTools → Network and Console, then reload. Find the first failing request: a wrong JavaScript path, HTML returned as a script, an incorrect MIME type or an API error. Compare expected and actual content.

Commands
curl -sS -i --max-time 5 http://localhost/assets/app.js
Example output
HTTP/1.1 200 OK
Content-Type: text/html

<!DOCTYPE html>...

The example has a successful status but returns HTML at a script URL. The response content and browser error reveal the problem.

Verify the user-visible result

After a change, recheck the same URL and resource, reload and inspect the Console. Verify that the expected interface appears and its main action works. curl does not execute JavaScript, so browser verification is a separate step.

The blank-page case includes a user-view preview. Use it before and after your fix.

Match HTML, JavaScript and MIME type

In the blank-page case, compare the HTML script reference, the real assets file and nginx’s rule for that URL. A 200 may contain old HTML or the wrong content type. An existing JavaScript file cannot help if HTML references another version.

Repeat the exact resource request after the change, then verify the visible interface. The case preview executes the page like a user’s browser; curl tests HTTP behavior without replacing that check.

Commands
curl -sS --max-time 5 http://localhost/
curl -sS -I --max-time 5 http://localhost/assets/app.js

app.js is an example. Headers help inspect MIME; use a separate GET on the actual HTML reference to verify its content.

From symptom to check

ObservationNext checkHow to interpret it
502Proxy and upstream reachabilityA middle layer responded; investigate its backend.
200 with a blank pageConsole, Network and script URLHTML arrived, but application loading or execution may have failed.
app.js returns HTMLBody, Content-Type, locationCompare the expected resource with nginx’s actual response.

Common mistakes

  • Checking only HEAD and drawing conclusions about content.
  • Treating /health returning 200 as a store-page test.
  • Fixing a JavaScript file that HTML never references.

How to prove recovery

  1. Repeat the original URL and request method.
  2. Check the failing resource’s Content-Type and body.
  3. Inspect the Console after a fresh page load.
  4. Verify the interface appears and its main user action works.

MINI INCIDENT

What does a green 200 establish?

The home page returns 200, but the browser reports a script MIME error. The JavaScript URL serves HTML. Which layer should you inspect before restarting the API?

Evidence to investigate
GET /                200 text/html
GET /assets/app.js   200 text/html
Explore the diagnosis

Inspect the script reference and nginx’s assets rule. The server returned a successful HTTP response with the wrong content. Restarting the API does not repair a mismatched URL or static path.

WORKSHOP

Workshop: explain the evidence and choose an action

Liveness is green while the user operation is broken. Choose the right level of evidence.

Sample evidence
GET /health → 200 {"status":"ok"}
GET /api/orders → 500
GET / → 200 text/html
  1. Which conclusion does each response support?

    Compare your reasoning

    Health confirms its narrow contract; / confirms document delivery; /api/orders demonstrates the required operation failing. Success on one route does not generalize to the others.

  2. What must stay the same in a repeat probe?

    Compare your reasoning

    Preserve method, URL, relevant headers, body and client context. Otherwise the new probe tests a different operation and creates a misleading comparison.

  3. Which test is required before closure?

    Compare your reasoning

    The original user operation and expected content, not just its status. A 200 carrying an application-error JSON body can still represent a broken operation.

CHECK YOUR UNDERSTANDING

The home page returns 200, but app.js receives HTML. Where should you look?

Show explanation

Check the script URL in HTML and static-file routing. The main page status does not confirm that JavaScript loaded correctly.

Documentation

Guest progress is stored separately in this browser.

TAKE IT TO THE TERMINAL

Practice on an incident

Start with the introductory incident or investigate a subtler failure: the server responds but the page stays blank.

DID IT MAKE SENSE?

Was this article helpful?

Rate the article or tell us what needed more explanation. Your feedback helps improve the lessons.

Helpful 0 Not helpful 0

Sign in to rate this article and leave a comment.

Discussion

0

Join the discussion →

No comments yet. Share your first impression or ask a question about this topic.