Security in depth · Unit 20 · Lesson 1 of 27
HTTP and proxies
Read requests, understand cookies, and separate transport protection from application permissions.
Helpful before thisWeb applications
After this lesson you can
- explain methods, status codes, and response bodies together
- distinguish cookie rules from session and access decisions
- describe what a proxy and TLS each protect
A web page may create many HTTP exchanges: loading a picture, checking a basket, or saving an address. Reading one request and its response helps you explain what happened. It does not, by itself, prove that the application made the right security decision.
GET /catalog HTTP/1.11
Host: books.example2
HTTP/1.1 200 OK3
Content-Type: application/json4
{"items":3}5- Method and target: retrieve the public catalog.
- The fictional service name; names can distinguish sites sharing an address.
- The server reports successful handling; this is not an authorization audit.
- The intended media type of this representation.
- Fictional application data. Content needs interpretation alongside status and headers.
EXPLORE THE CONCEPT
What does this response establish?
Choose a response and separate its meaning from the application's permission decision.
A successful HEAD
The response can report success and representation metadata without a content body. The status does not independently prove correct authorization.
A 403 refusal
The server refuses the request. A gateway or application rule may have produced it, so it does not establish that a specific resource exists.
A cached receipt
A private receipt needs an appropriate sharing and storage policy. Identify whether the browser, application, or shared cache retained it before assigning the cause.
A simplified learning model. It connects to no systems and uses no real data.
A request describes an operation
The method states the intended operation. The target names the resource; headers carry metadata; some requests include a body. HTTP versions encode these details differently while retaining shared semantics.
GET is defined as safe: the client is requesting retrieval rather than a state change. Incidental logging is compatible with that definition. A GET that deletes an account violates the intended semantics and creates risks from automatic retrieval. Idempotence means repeating an operation has the same intended effect as doing it once; the responses and logs need not be identical. These distinctions come from HTTP semantics.
Status is a clue, not the whole answer
A 2xx response reports successful handling under the status’s meaning, not correct authorization. A successful HEAD response has no content body. A 3xx response is not always a redirect to a different location: 304 relates to cache validation.
401 concerns missing or invalid authentication credentials; 403 means the server refuses the request. Applications may deliberately use 404 to conceal a resource. Read the documented behavior, response body, and relevant server evidence together.
Cookies carry values
A cookie may hold a preference, a session identifier, or other state. Secure restricts transmission to secure channels; HttpOnly prevents script access through cookie APIs; SameSite affects attachment to cross-site requests. Domain and Path control delivery, but Path is not a reliable isolation boundary between applications.
These attributes complement session expiration and authorization. They do not establish that the current user may read a particular receipt.
TLS and proxies have different jobs
TLS protects a connection against network observation and modification when peers and trust are validated correctly. It cannot decide whether a refund is legitimate. A forward proxy serves clients; a reverse proxy sits in front of services. A debugging proxy can inspect HTTPS only when the client and traffic are configured to trust and use it. Some traffic is merely tunneled.
Only designated trusted proxies should supply identity-related forwarding information, with the application handling untrusted incoming values consistently.
Scenario: the receipt that stayed in cache
Mina signs out of a shared tablet. The next shopper sees Mina’s receipt. Several explanations remain possible: application state, browser history, local caching, or a shared cache. The team identifies the actual storage layer before choosing controls.
Authenticated responses are not automatically unsafe to cache. They need policies suited to their sensitivity and sharing rules. CORS is another separate boundary: it governs browser access to cross-origin responses. A wildcard allowed origin does not permit credentialed sharing under Fetch; browsers reject that combination. Server authorization remains necessary.
A useful note records the operation, the expected permission, the observed result, and which component supplied the evidence.
Choose a policy from an actual requirement
The fictional shop has two requirements. Public catalog responses may be reused for sixty seconds. Receipts must not be stored by HTTP caches. Compare these proposed receipt policies:
| Proposal | What it controls |
|---|---|
| private | Excludes shared-cache storage; a private cache may still store it. |
| no-cache | Requires successful validation before reuse; storage remains possible. |
| no-store | Directs HTTP caches not to store the response. |
For the non-personalized public catalog, public, max-age=60 permits shared storage and a sixty-second freshness lifetime, subject to HTTP cache rules. This is the shop’s stated policy, not a recommendation for every catalog. Only the third receipt proposal matches its no-storage requirement. These are response directives without field-name arguments. They govern compliant HTTP caches; they are not deletion commands for screenshots, exported files, or all application-managed storage.
PredictThe team changes future receipts to no-store. Can it close the shared-tablet issue immediately?
It has selected the matching HTTP policy, but must still identify the copy already displayed and verify the affected lifecycle. New headers do not prove that an existing application copy, history entry, or exported file has disappeared.
Trace the connections too. Suppose TLS ends at the shop’s reverse proxy, which starts a separate connection to the application. Browser certificate validation covers the browser-to-proxy connection. The proxy-to-application path needs its own documented protection and peer validation. A lock icon cannot establish that second configuration.
The review note should therefore separate three claims: the selected cache directive meets a stated requirement, the observed copy came from a particular storage layer, and each network connection has the intended protection. Evidence for one does not establish the others.
Terms you met
Check yourself
No timer. No penalties. Read the explanation and try again whenever you like.
This lesson’s questions have changed. Your reading progress is saved; review the updated questions.
-
The requirement says HTTP caches must not store a receipt. Which response directive directly matches it?
Show the answer
Correct answer: no-store It instructs HTTP caches not to store the response. Other copies and already-stored application data need separate consideration.
-
TLS terminates at a reverse proxy. What does a successful browser certificate check establish?
Show the answer
Correct answer: The browser authenticated its TLS peer under its configured trust rules. The claim is limited to that connection. Review the next connection and application permissions separately.
-
A GET catalog request also creates an access-log entry. How does this fit safe-method semantics?
Show the answer
Correct answer: The client requested retrieval; incidental logging is compatible with that meaning. Safe describes the requested operation. It does not forbid internal accounting or logging.
-
A session cookie is HttpOnly. Which conclusion is justified?
Show the answer
Correct answer: Cookie APIs do not expose that cookie to script; other application actions need their own controls. The attribute limits cookie access, while rendering, request protection, and authorization remain separate.
-
The shop adds no-store, but yesterday's receipt remains visible on the tablet. What is the most useful next evidence?
Show the answer
Correct answer: A trace identifying whether the display uses a new response, an HTTP cache, or application-managed state. Identify the retaining component and lifecycle before judging which storage control failed.
Try it
- WriteFor the shop, choose a response cache policy for catalogs and receipts and explain its scope. Draw browser, reverse proxy, and application as two separate connections. List one verification record for receipt storage and one for the second connection.