How the Web Works: HTTP, Cookies, and Trust
Build your web security foundations with clear explanations of HTTP, cookies, origins, permissions, and the full request lifecycle.
You’re reading a preview. Premium includes the full lesson and specialist practice. View the full curriculum.
Start with one ordinary click
Alice opens a web app, clicks a note, and changes its title. Nothing about that sounds like a security problem. Yet this small action brings together almost everything we need to understand before studying web vulnerabilities: messages crossing the internet, a remembered login, data chosen by a user, permission checks, a database write, and content displayed in a browser.
We will take that action apart slowly. First we will look at the browser and server as two people exchanging messages. Then we will open the messages, follow them through the application, and ask where a claim needs to be checked. By the end, terms such as session, origin, principal, and trust boundary should describe something you can picture.
This is the first foundation lesson in the web application security course. Allow about one hour for the reading and worked examples. The linked interactive exercise is additional practice. You do not need an intercepting proxy or experience with a particular programming language to begin. When code appears, read the explanation beside it before worrying about syntax.
Here is our route through the lesson:
| Part of the journey | What you will learn to explain |
|---|---|
| A browser asks for something | Clients, servers, URLs, HTTPS, and HTTP messages. |
| The server recognizes a user | Cookies, sessions, authentication, and authorization. |
| The browser and application apply rules | Origins, sites, CORS, CSRF, validation, and permissions. |
| The request reaches its destination | Proxies, application layers, database operations, responses, and verification. |
1. What actually happens when you open a page?
A client is a program asking another program for a service. Your browser is a client. A server is a program that receives requests and sends responses. The word can also mean the computer running that program; here, we mainly mean the software.
Think of ordering a book from a library desk. You ask for a particular book. A librarian checks what you requested, decides whether you may borrow it, and hands you a result. The request, the permission check, and the result are three different things. Writing a book's title on a slip does not grant borrowing rights.
A web app follows a similar pattern. The browser sends a request, and the server sends a response. HTTP, short for Hypertext Transfer Protocol, defines how those messages express things such as “retrieve this resource” and “here is the result.” A resource is something addressed by the application: a page, a note, an image, or an account record.
The page you see and the software behind it
A typical browser page uses three building blocks. HTML describes content and structure: headings, links, forms, and buttons. CSS controls presentation, such as spacing and colors. JavaScript adds behavior, such as loading a note when Alice clicks it.
The code running in the browser is the frontend. The application code receiving requests on the server is the backend. The backend often uses a database, which stores records such as users and notes. The frontend can ask for a change; the backend decides whether to make it.
An API, or application programming interface, is an interface software can call. A browser might first receive an HTML page, then have its JavaScript request note data from /api/notes/42. That second response might contain JSON, a text format for structured data, rather than a complete page. The /api/ prefix is a convention, not a security feature.
One click can therefore cause several requests. The browser may retrieve HTML, CSS, scripts, images, and API data from different addresses. The address bar shows the page's URL, not a complete list of every request that page makes. Browser developer tools have a Network panel where those requests can be inspected.
Finding and reaching the server
Before the browser can exchange application messages, it needs a destination and a connection. DNS, the Domain Name System, helps translate a name such as app.venuenotes.test into an IP address, a numeric address used to reach a network destination. Think of looking up a business's number before calling it.
The browser then establishes or reuses a connection. With HTTPS, it uses TLS, a protocol that encrypts the traffic and authenticates the server's identity through certificates. This protects messages between the browser and the server handling that encrypted connection against ordinary network interception and modification.
HTTP/1.1, HTTP/2, and HTTP/3 organize transmission differently. You do not need their wire formats yet. The ideas we will inspect—method, target, headers, body, and response—remain useful across them.
Our fictional app is VenueNotes. Alice's private note is 42; Bob's private note is 77. For now, each person may read and edit only their own notes. Later we will add workspaces to show how the same reasoning handles teams.