Session 1: Architecture of the Web
π Brief History of the Internet
| Year |
Event |
| 1969 |
ARPANET - First network connecting 4 universities |
| 1983 |
TCP/IP protocol adopted |
| 1989 |
Tim Berners-Lee invents the World Wide Web at CERN |
| 1991 |
First website goes live |
| 1993 |
Mosaic browser released |
| 1995 |
JavaScript, PHP introduced |
| 2000s |
Web 2.0, AJAX, Social Media era |
| 2010s |
Mobile-first, HTML5, CSS3, Modern frameworks |
π How Does the Internet Work?
The Internet is a global network of interconnected computers that communicate using standardized protocols.
Key Components:
- Client - Your browser (Chrome, Firefox, Safari)
- Server - Computer hosting websites
- Router - Directs traffic between networks
- ISP - Internet Service Provider connects you to the Internet
- DNS - Translates domain names to IP addresses
Data Flow:
User Request β Browser β ISP β DNS β Server β Response β Browser β User
π‘ Internet Protocol (IP)
IP Address - Unique numerical address for every device on the Internet.
| Version |
Format |
Example |
| IPv4 |
32-bit (4 octets) |
192.168.1.1 |
| IPv6 |
128-bit (8 groups) |
2001:0db8:85a3:0000:0000:8a2e:0370:7334 |
Port Numbers:
| Port |
Protocol/Service |
| 80 |
HTTP |
| 443 |
HTTPS |
| 21 |
FTP |
| 22 |
SSH |
| 25 |
SMTP (Email) |
| 3306 |
MySQL |
π Domain Names & DNS
DNS (Domain Name System) - The βphonebookβ of the Internet that translates human-readable domain names to IP addresses.
Domain Name Structure:
https://www.example.com:443/path/page.html
βββ¬ββ ββ¬β βββββ¬βββββββ¬βββββββββ¬βββββββ
Protocolβ Domain Port Path
Subdomain
Domain Hierarchy:
.com (TLD - Top Level Domain)
βββ example (Second Level Domain)
βββ www (Subdomain)
Common TLDs:
| TLD |
Purpose |
| .com |
Commercial |
| .org |
Organizations |
| .edu |
Educational |
| .gov |
Government |
| .in |
India (Country Code) |
| .io |
Tech startups (Originally British Indian Ocean Territory) |
DNS Resolution Process:
- Browser checks local cache
- OS checks hosts file
- Query to DNS Resolver (ISP)
- Query to Root DNS Server
- Query to TLD DNS Server
- Query to Authoritative DNS Server
- IP address returned to browser
π HTTP Protocol
HTTP (HyperText Transfer Protocol) - Application layer protocol for transmitting hypermedia documents.
HTTP Versions Comparison:
| Feature |
HTTP/1.0 |
HTTP/1.1 |
HTTP/2.0 |
| Connections |
New connection per request |
Persistent connections (Keep-Alive) |
Multiplexing (single connection) |
| Request Pipelining |
β No |
β
Yes (limited) |
β
Yes (improved) |
| Header Compression |
β No |
β No |
β
Yes (HPACK) |
| Server Push |
β No |
β No |
β
Yes |
| Binary Protocol |
β Text |
β Text |
β
Binary |
| Stream Priority |
β No |
β No |
β
Yes |
π¨ HTTP Methods (Verbs)
| Method |
Purpose |
Idempotent |
Safe |
Request Body |
| GET |
Retrieve data |
β
Yes |
β
Yes |
β No |
| POST |
Submit data (create) |
β No |
β No |
β
Yes |
| PUT |
Update/Replace resource |
β
Yes |
β No |
β
Yes |
| PATCH |
Partial update |
β No |
β No |
β
Yes |
| DELETE |
Remove resource |
β
Yes |
β No |
Optional |
| HEAD |
GET without body (headers only) |
β
Yes |
β
Yes |
β No |
| OPTIONS |
Get supported methods |
β
Yes |
β
Yes |
β No |
GET vs POST:
| Aspect |
GET |
POST |
| Data Location |
URL query string |
Request body |
| Data Visibility |
Visible in URL |
Hidden in body |
| Data Length |
Limited (~2048 chars) |
No limit |
| Caching |
Can be cached |
Not cached |
| Bookmarking |
Can be bookmarked |
Cannot be bookmarked |
| Security |
Less secure |
More secure |
| Idempotent |
Yes |
No |
π HTTP Status Codes
Categories:
| Range |
Category |
Meaning |
| 1xx |
Informational |
Request received, continuing |
| 2xx |
Success |
Request successfully received |
| 3xx |
Redirection |
Further action needed |
| 4xx |
Client Error |
Bad request from client |
| 5xx |
Server Error |
Server failed to fulfill request |
Important Status Codes:
| Code |
Message |
Description |
| 100 |
Continue |
Server received headers, client should proceed |
| 200 |
OK |
Request succeeded |
| 201 |
Created |
Resource created successfully |
| 204 |
No Content |
Success but no content to return |
| 301 |
Moved Permanently |
Resource permanently moved (SEO friendly) |
| 302 |
Found |
Temporary redirect |
| 304 |
Not Modified |
Use cached version |
| 400 |
Bad Request |
Invalid request syntax |
| 401 |
Unauthorized |
Authentication required |
| 403 |
Forbidden |
Access denied |
| 404 |
Not Found |
Resource doesnβt exist |
| 405 |
Method Not Allowed |
HTTP method not supported |
| 500 |
Internal Server Error |
Server error |
| 502 |
Bad Gateway |
Invalid response from upstream server |
| 503 |
Service Unavailable |
Server temporarily unavailable |
| 504 |
Gateway Timeout |
Upstream server timeout |
π HTTP Session & Stateless Nature
Stateless Protocol:
- HTTP doesnβt remember previous requests
- Each request is independent
- Server doesnβt maintain client state
Why Stateless?
- Scalability - Any server can handle any request
- Simplicity - No need to manage state
- Reliability - Failed requests donβt affect others
Maintaining State:
| Technique |
Storage |
Duration |
Size Limit |
| Cookies |
Browser |
Configurable |
4KB per cookie |
| Session |
Server |
Until logout/timeout |
No limit |
| LocalStorage |
Browser |
Permanent |
5-10MB |
| SessionStorage |
Browser |
Tab session |
5-10MB |
| URL Parameters |
URL |
Per request |
~2048 chars |
Session Management:
1. Client sends login request
2. Server creates session ID
3. Server sends session ID in cookie
4. Client sends cookie with every request
5. Server validates session ID
π HTTPS (HTTP Secure)
HTTPS = HTTP + TLS/SSL encryption
How HTTPS Works:
1. Client requests HTTPS connection
2. Server sends SSL certificate
3. Client verifies certificate
4. Client/Server negotiate encryption
5. Secure encrypted communication begins
SSL/TLS Handshake:
- Client Hello - Supported cipher suites, random number
- Server Hello - Selected cipher suite, random number, certificate
- Key Exchange - Pre-master secret exchange
- Finish - Both sides confirm secure connection
HTTPS Benefits:
- Encryption - Data cannot be read in transit
- Integrity - Data cannot be modified
- Authentication - Verify server identity
- SEO - Google ranks HTTPS sites higher
π₯οΈ Web Servers
A Web Server is software that serves web content to clients.
Popular Web Servers:
| Server |
Platform |
Key Features |
| Apache HTTP Server |
Cross-platform |
Open source, .htaccess, modules |
| Nginx |
Cross-platform |
High performance, reverse proxy, load balancing |
| IIS (Internet Information Services) |
Windows |
ASP.NET integration, GUI management |
| LiteSpeed |
Cross-platform |
Apache compatible, high performance |
| Node.js |
Cross-platform |
JavaScript runtime, event-driven |
Apache vs Nginx:
| Feature |
Apache |
Nginx |
| Architecture |
Process-based |
Event-driven |
| Static Content |
Slower |
Faster |
| Dynamic Content |
Better (mod_php) |
Requires proxy |
| Configuration |
.htaccess (flexible) |
Central config |
| Memory Usage |
Higher |
Lower |
ποΈ Web Architecture Patterns
Client-Server Architecture:
βββββββββββ HTTP Request βββββββββββ
β Client β ββββββββββββββββββΊ β Server β
β(Browser)β ββββββββββββββββββ β (Web) β
βββββββββββ HTTP Response βββββββββββ
Three-Tier Architecture:
βββββββββββββββ ββββββββββββββββ ββββββββββββ
β PresentationββββΊβ Application ββββΊβ Database β
β (UI/UX) β β (Logic) β β (Data) β
βββββββββββββββ ββββββββββββββββ ββββββββββββ
MVC (Model-View-Controller):
User
β
βΌ
βββββββββββββ
β View β ββββββββββββββββ
βββββββββββββ β
β β
βΌ β
βββββββββββββ βββββββββββββ
β Controllerβ βββββββββΊβ Model β
βββββββββββββ βββββββββββββ
π‘ Key MCQ Points
Remember these for CCEE:
- HTTP is stateless - doesnβt remember previous requests
- Port 80 = HTTP, Port 443 = HTTPS
- GET - retrieve data, POST - submit data
- 200 = OK, 404 = Not Found, 500 = Server Error
- DNS translates domain names to IP addresses
- HTTP/2 supports multiplexing and header compression
- HTTPS uses TLS/SSL for encryption
- Nginx is event-driven, Apache is process-based
- Cookie max size = 4KB, LocalStorage = 5-10MB
- 301 = Permanent redirect, 302 = Temporary redirect