VMware ESXi and vSphere Cluster Management
Hypertext Transfer Protocol (HTTP)
Learn how HTTP clients and web servers exchange resources, how URLs and requests work, why TCP port 80 is the default, and how HTTP differs from HTTPS.
Hypertext Transfer Protocol (HTTP) is an application-layer protocol for exchanging web resources between clients and servers. It defines how a client requests content or asks a server to perform an action, and how the server returns a response.
Web resources can include HTML documents, plain text, images, style sheets, JavaScript files, videos, downloadable files, and data returned by web applications.
What HTTP Does
HTTP provides the communication rules used by web applications. A browser sends an HTTP request to a web server. The server processes that request and sends an HTTP response containing a result, such as a requested HTML document or an error message.
HTTP is an application-layer protocol. The application layer contains protocols that provide network services directly to applications. HTTP depends on lower-layer protocols for tasks such as addressing, reliable delivery, and connection management.
The HTTP Client-Server Model
An HTTP exchange has two primary roles:
| Component | Role | Typical Example |
|---|---|---|
| HTTP client | Initiates a request for a resource or service. | A web browser, mobile application, or command-line tool such as curl |
| HTTP server | Receives requests, processes them, and sends responses. | Web-server software hosting a website or web application |
| Requested resource | The content or service identified by the request. | An HTML page, image, style sheet, script, or API data |
A web browser is the most familiar HTTP client. It requests an initial HTML document and then commonly makes additional requests for resources referenced by that document, such as images, CSS style sheets, and scripts.
Typical page-loading sequence
- A user enters a URL, such as
http://www.example.com, into a browser. - The browser resolves the host name to an IP address using DNS.
- For ordinary HTTP, the browser establishes a TCP connection to the server on port 80 unless another port is specified.
- The browser sends an HTTP
GETrequest for the selected resource. - The server returns an HTTP response with a status code, headers, and usually a response body.
- The browser processes the HTML and may send more requests for images, style sheets, scripts, and other referenced resources.
HTTP Requests and Responses
An HTTP request is a message sent by a client to obtain a resource or perform an action. An HTTP response is the message returned by the server. The response reports the outcome and may contain the requested content.
| Message Type | Key Elements | Purpose |
|---|---|---|
| Request | Method, target resource, headers, and sometimes a body | Asks for a resource or asks the server to perform an operation |
| Response | Status code, headers, and usually a response body | Reports the result and may return content or data |
Request methods
The method indicates the intended action. GET is primarily used to retrieve a resource, such as a web page. POST is commonly used to submit data to a server, such as login information, a form submission, or a new record for an application.
A simplified request might look like this:
GET /index.html HTTP/1.1
Host: www.example.comHere, GET is the method, /index.html is the target path, and the Host header identifies the intended website. Real requests usually contain additional headers, such as accepted content types and client information. A request body may carry submitted data, especially with methods such as POST.
Response status codes
An HTTP status code is a numeric result in a response. It tells the client whether the request succeeded, needs further action, or failed.
| Status Code | Meaning | Example Situation |
|---|---|---|
| 200 OK | The request succeeded. | The server returns the requested HTML page. |
| 301 or 302 redirect | The client should request another URL. | A site redirects an old address to a new address or redirects HTTP to HTTPS. |
| 403 Forbidden | The server understood the request but refuses access. | A user is not authorized to view a protected resource. |
| 404 Not Found | The requested resource was not located. | The URL path is incorrect or the resource was removed. |
| 500 Internal Server Error | The server encountered an unexpected problem. | An application or server-side component failed while processing the request. |
A simplified successful response might look like this:
HTTP/1.1 200 OK
Content-Type: text/html
<html>...page content...</html>The first line gives the HTTP version and status. Headers provide metadata about the response. The body contains the returned representation, such as HTML.
URLs and HTTP Resource Access
A URL, or Uniform Resource Locator, identifies a resource and describes how to access it. A URL used with HTTP can contain these main components:
- Scheme: identifies the protocol, such as
http://orhttps://. - Host name: identifies the destination, such as
www.example.com. - Port: optionally identifies the transport-layer service port, such as
:80. - Path: identifies a resource or application route, such as
/products/index.html. - Query string: begins with
?and supplies parameters, such as?category=books. - Fragment: begins with
#and identifies a portion of a resource, such as#details.
For example:
http://www.example.com:80/products/index.html?category=books#detailsIn this URL, http is the scheme, www.example.com is the host name, 80 is the explicit port, /products/index.html is the path, category=books is the query string, and details is the fragment.
The fragment is normally handled by the client, usually the browser. It identifies a location within the returned document and is generally not sent in the HTTP request. The server receives the scheme-relevant destination, path, and query string, but not the fragment identifier.
TCP and HTTP Port 80
Traditional HTTP/1.1 communication uses TCP, a reliable transport-layer protocol. TCP uses port numbers to identify services on a host.
TCP port 80 is the well-known default port for HTTP. When a URL begins with http:// and does not include a port, the client normally assumes port 80.
These URLs normally identify the same service endpoint:
http://www.example.com/
http://www.example.com:80/The first URL relies on the default. The second explicitly specifies TCP port 80. They can differ only if the server or network uses unusual configuration.
HTTP Versions
| Version | Underlying Transport | High-Level Characteristic |
|---|---|---|
| HTTP/1.1 | TCP | A longstanding and widely supported version using text-based message conventions and persistent TCP connections. |
| HTTP/2 | TCP | Preserves HTTP semantics while improving efficiency with features such as binary framing and multiplexed streams over a TCP connection. |
| HTTP/3 | QUIC, normally over UDP | Uses QUIC as its transport foundation to provide modern connection and stream behavior while retaining HTTP concepts such as methods, URLs, headers, and status codes. |
HTTP/2 changes how messages are transported and organized, but the fundamental web concepts remain: clients make requests, servers return responses, and resources are identified by URLs. HTTP/3 uses QUIC rather than TCP, so the statement that HTTP uses TCP applies specifically to HTTP/1.1 and HTTP/2, not to every modern HTTP version.
HTTP Versus HTTPS
HTTPS is HTTP protected by TLS, or Transport Layer Security. TLS provides encryption, helps authenticate the server, and helps detect tampering while HTTP data crosses the network.
| Protocol/Scheme | Transport | Default Port | Security Characteristics |
|---|---|---|---|
HTTP (http://) | TCP for HTTP/1.1 and HTTP/2 | 80 | HTTP data is not protected by TLS and can be observed or modified on an untrusted path. |
HTTPS (https://) | Usually TCP for HTTP/1.1 and HTTP/2; QUIC for HTTP/3 | 443 | HTTP is protected by TLS, providing encryption and server authentication. |
HTTPS is expected for login pages, private information, payments, and most modern websites. For example, http://www.example.com normally uses port 80 without TLS, while https://www.example.com normally uses port 443 and establishes TLS protection before exchanging HTTP data.
Inspecting HTTP with curl
curl is a command-line HTTP client useful for observing request and response behavior.
curl -I http://www.example.comThe -I option requests response headers only. It exposes the response status line and headers without downloading the normal response body.
curl -v http://www.example.com/The -v option displays connection details, the outgoing request, and response information. It can help show which host and port are being contacted.
curl -I http://www.example.com:80/This command tests an explicitly specified default HTTP port and demonstrates that :80 normally has the same endpoint meaning as omitting the port.
curl -I https://www.example.com/This command inspects a secure HTTP endpoint and contrasts HTTPS, conventionally using port 443, with unencrypted HTTP.
Troubleshooting HTTP Access
The browser cannot connect to an HTTP site
Possible causes include failed DNS resolution, an offline server, a firewall blocking TCP port 80, or a service listening on a nondefault port.
- Verify that the host name resolves to an IP address.
- Confirm the URL spelling and port.
- Test TCP connectivity to the server's HTTP port.
- Verify that the web-server service is running and listening.
The server returns 404 Not Found
A 404 response means the server did not locate the requested resource. The path may be incorrect, the resource may have been renamed or removed, or server routing may map the URL incorrectly.
- Review the URL path and spelling.
- Confirm that the target file or application route exists.
- Check the server's routing and document-root configuration.
The site redirects from HTTP to HTTPS
The server may enforce encrypted access or the application may require HTTPS. Inspect the response's Location header, follow the destination, and verify that port 443 is reachable.
An HTTP URL works without a port but fails with a custom port
The custom port may have no listening service, may be blocked by a firewall, or may be incorrect. Use port 80 when the service is ordinary HTTP, or confirm the configured listening port and its firewall rules.
Exam-Ready Summary
- HTTP is an application-layer protocol for exchanging web resources between clients and servers.
- A browser commonly acts as the HTTP client; a web server receives requests and returns responses.
- Requests include a method, target resource, headers, and sometimes a body.
- Responses include a status code, headers, and usually a body.
GETcommonly retrieves a resource;POSTcommonly submits data.- The
http://scheme implies TCP port 80 when no port is written. http://www.example.com/andhttp://www.example.com:80/normally address the same HTTP service.- HTTP/1.1 and HTTP/2 use TCP; HTTP/3 uses QUIC.
- HTTPS is HTTP protected by TLS and conventionally uses port 443.
- A URL fragment is generally processed by the client and is not sent in the HTTP request.
For a related lesson, see Hypertext Transfer Protocol (HTTP).