Course contentsShow
← Web Development
Lesson 2199 of 2,98240. Browser DevTools Deep DiveFree lesson

Request and Response Headers

Inspect HTTP headers to understand caching directives, content types, CORS headers, and security policies.

Request and Response Headers

You'll learn how to inspect HTTP headers in DevTools to decode caching rules, content formats, cross-origin permissions, and security configurations.

What HTTP Headers Are

Think of HTTP headers as the metadata envelope around your web content—like the addressing, handling instructions, and security seals on a physical package. While the response body contains the actual content (HTML, JSON, images), headers carry essential instructions about how to handle that content.

When you click a resource in the Network panel and view the Headers tab, you see two sections: request headers (what your browser sent) and response headers (what the server replied with).

Key Headers to Inspect

Caching Directives:

  • Cache-Control: max-age=3600, public tells browsers and CDNs how long to store the resource
  • ETag and Last-Modified enable validation without re-downloading

Content Information:

  • Content-Type: text/html; charset=UTF-8 specifies what you received
  • Content-Encoding: gzip shows compression applied
  • Content-Length indicates size in bytes

CORS Headers:

  • Access-Control-Allow-Origin: * permits cross-origin requests
  • Access-Control-Allow-Methods lists allowed HTTP methods

Security Policies:

  • Strict-Transport-Security enforces HTTPS
  • Content-Security-Policy restricts resource loading
  • X-Frame-Options prevents clickjacking

Why This Matters

Inspecting headers helps you diagnose issues like stale caches, CORS blocking, unexpected compression, or missing security policies. You can verify your server configuration matches your intentions.

Key Takeaway: Request and response headers are the instruction manual for how browsers, CDNs, and servers should handle each resource—master reading them to diagnose caching, security, and delivery issues effectively.