Reference

HTTP & network inspection

Decode requests, responses, browser rules and network diagnostics.

Scope and conventions

Wire examples use HTTP/1.1 notation; HTTP/2 and HTTP/3 encode it differently. Commands use a Unix-like shell and illustrative example.test hosts. Browser security behavior is labeled separately from HTTP and command-line clients.

Browser boundaries

Set and send a cookie

HTTP & tools

Set-Cookie is a response header. Cookie is a request header. HttpOnly blocks script access, Secure restricts sending to secure transport, and SameSite controls cross-site sending.

Fragment

HTTP & tools · Set and send a cookie
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
Set-Cookie: session=VALUE; Path=/; Secure; HttpOnly; SameSite=Lax

# Later request:
Cookie: session=VALUE

A missing Domain makes a host-only cookie. Cookie Path is not an authorization boundary.

Read SameSite cookie policy

HTTP & tools

Strict is most restrictive for cross-site sending. Lax permits some top-level safe navigations. None permits cross-site use and requires Secure in current browsers.

Fragment

HTTP & tools · Read SameSite cookie policy
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
Set-Cookie: session=VALUE; Path=/; SameSite=None; Secure

Browser privacy policies can still block third-party cookies. Cookie policy alone does not establish a complete CSRF defense.

Understand what CORS controls

HTTP & tools

CORS controls whether browser script can access a cross-origin response. It is not authentication. Some cross-origin requests are sent even when the response is unreadable.

Fragment

HTTP & tools · Understand what CORS controls
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
Access-Control-Allow-Origin: https://app.example.test
Vary: Origin

curl does not enforce browser CORS. Do not reflect arbitrary origins when allowing credentials.

Recognize a preflight exchange

HTTP & tools

Browsers send OPTIONS before certain cross-origin requests, using the proposed method and header names. The server responds with its permitted origins, methods and headers.

Fragment

HTTP & tools · Recognize a preflight exchange
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
OPTIONS /items HTTP/1.1
Host: api.example.test
Origin: https://app.example.test
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type

A cross-origin request with Content-Type: application/json always triggers preflight, because it is not a CORS-safelisted type. A successful preflight does not authorize the subsequent operation.

Send cross-origin cookies with Fetch

HTTP & tools

credentials: "include" asks the browser to include credentials, subject to cookie policy. Credentialed CORS needs an explicit allowed origin and Access-Control-Allow-Credentials: true.

Fragment

HTTP & tools · Send cross-origin cookies with Fetch
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
const response = await fetch(
  "https://api.example.test/profile",
  { credentials: "include" }
);

Access-Control-Allow-Origin: * cannot expose a credentialed response. SameSite rules still apply.