TCP, HTTP, and HTTPS: The Layers Behind a Web Request

Separate transport, HTTP meaning, and TLS security so you can explain a web request and diagnose the layer where it fails.

On this page

The short answer

TCP, HTTP, and HTTPS are not interchangeable names for “the web.” They solve different problems:

  • TCP commonly carries HTTP/1.1 and HTTP/2 as a reliable, ordered byte stream.
  • HTTP gives a request and response their application meaning.
  • TLS authenticates an endpoint and protects application data in transit.
  • HTTPS is HTTP communicated over a connection secured with TLS.

HTTP/3 is the important variation: it uses QUIC over UDP instead of TCP. QUIC provides secure, reliable streams and integrates the TLS 1.3 handshake.

The layers mental model

Mental model

For common HTTPS using HTTP/1.1 or HTTP/2:

HTTP → TLS → TCP → IP

For HTTP/3:

HTTP/3 → QUIC with integrated TLS → UDP → IP

Read the arrows as “uses the service below.” This is a learning model, not a complete networking-stack specification. Implementations combine work, negotiate protocols, and interact with operating-system and network layers in more detail.

System traceTwo common secure HTTP stacksBoth paths preserve HTTP request and response meaning. HTTP/1.1 and HTTP/2 commonly use TLS over TCP; HTTP/3 uses secure QUIC streams carried in UDP datagrams.
  1. HTTP/1.1 or HTTP/2HTTP → TLS → TCP → IP
  2. HTTP/3HTTP/3 → QUIC + TLS → UDP → IP

The model matters because a failure at one layer says something about the layers below it. If a server returns an HTTP status, enough transport and protocol work succeeded for an HTTP response to arrive. If certificate validation fails, the browser usually has not sent the ordinary HTTP request yet.

What TCP provides

TCP is a transport protocol. It gives two applications a reliable, in-order stream of bytes. The sender can write data without having to make the application repair every lost or reordered IP packet; TCP numbers data, acknowledges receipt, retransmits missing data, and controls how much it sends.

Before exchanging an ordinary byte stream, TCP endpoints establish connection state with a three-way handshake: a SYN, a SYN plus acknowledgment, and an acknowledgment. RFC 9293 specifies this connection establishment and reliable byte-stream service.See RFC 9293’s functional specification and connection-establishment sections.1

“Reliable” does not mean “the request must succeed.” A connection can time out, reset, or close. TCP also does not know that bytes contain an HTTP method, a JSON body, or a status code. Those meanings belong to the application protocol above it.

What HTTP provides

HTTP is an application protocol for exchanging messages about resources. A client sends a request that states a method and target, fields that provide context, and sometimes content. A server sends a response with a status code, fields, and sometimes content.

HTTP semantics answer questions such as:

  • What operation is requested?
  • Which resource is the target?
  • What representation can the client accept?
  • Did the server satisfy the request, redirect it, reject it, or fail?
  • Can a response be cached or reused?

RFC 9110 defines these semantics independently of one wire format.RFC 9110 is the common semantics specification for current HTTP versions.2 HTTP/1.1 uses a textual message syntax; HTTP/2 and HTTP/3 encode the same broad request-response model using binary framing.

What TLS provides

TLS protects data exchanged between endpoints. During a TLS handshake, client and server negotiate cryptographic parameters and derive traffic keys. The server presents credentials—normally an X.509 certificate chain—that the client validates against the service it intended to reach and its configured trust anchors.

TLS 1.3 is designed to provide:

  • authentication, ordinarily of the server and optionally of the client;
  • confidentiality, so network observers cannot read protected application data;
  • integrity, so modification of protected data is detected.

RFC 8446 defines the TLS 1.3 handshake and these protection goals.See RFC 8446’s protocol overview and security properties.5 TLS protects a channel. It does not decide whether the authenticated application is ethical, correctly coded, or authorized to perform a business operation.

How HTTPS combines HTTP with encryption

An https URL says that HTTP communication uses a secured connection. For HTTP/1.1 and HTTP/2, the common stack is HTTP messages or frames over TLS over TCP. After DNS supplies an address, TCP connection establishment occurs, then the TLS handshake protects the channel, and then the client sends ordinary HTTP application data.

HTTPS is therefore not a separate application protocol unrelated to HTTP. The request still has HTTP methods, fields, content, and response status codes. TLS changes how that application exchange is protected while it travels.

Key takeaway

HTTP defines what the messages mean. TLS protects those messages in transit. TCP commonly transports the protected byte stream for HTTP/1.1 and HTTP/2.

A common HTTP/1.1 or HTTP/2 request journey

After DNS resolution, a typical new HTTPS connection follows this high-level sequence:

  1. The client starts a TCP connection to an address and port.
  2. Client and server complete TCP connection establishment.
  3. They perform a TLS handshake. The client validates the server’s identity and they derive traffic keys.
  4. Protocol negotiation can select HTTP/2; otherwise the connection may use HTTP/1.1, depending on support and policy.
  5. The client sends a protected HTTP request.
  6. The server returns a protected HTTP response.
  7. The connection may be reused for later requests.

HTTP/1.1 defines its message syntax and TCP-connection use.RFC 9112 specifies HTTP/1.1 messaging.3 HTTP/2 replaces that text framing with multiplexed binary streams while retaining HTTP semantics.RFC 9113 defines HTTP/2 framing and connection behavior.4

Several steps can be skipped or combined in practice. A browser may reuse an existing connection. TLS can resume a previous session. A proxy may terminate one connection and create another to an upstream service. The sequence is a common boundary map, not a promise of one handshake per request.

Where HTTP/3 and QUIC differ

HTTP/3 maps HTTP semantics onto QUIC rather than TCP.RFC 9114 defines HTTP/3 over QUIC.6 QUIC runs in UDP datagrams, but it is not “unreliable HTTP.” QUIC itself supplies reliable streams, congestion control, connection state, and security based on TLS 1.3.RFC 9000 defines QUIC packets, streams, recovery, and TLS integration.7

This matters because saying “HTTP always uses TCP” is no longer correct. The durable statement is:

  • HTTP/1.1 and HTTP/2 commonly use TCP.
  • HTTP/3 uses QUIC over UDP.
  • All three retain HTTP’s application-level request and response semantics.

Clients and servers can support more than one version. Selection depends on capabilities, learned alternatives, negotiation, and network conditions. Failure to use HTTP/3 does not necessarily prevent a client from trying an available TCP-based HTTP version.

Anatomy of an HTTP request

Here is a simplified HTTP/1.1 request. It shows the concepts clearly even though HTTP/2 and HTTP/3 encode them differently.

Illustrative HTTP/1.1 requesthttp
GET /products/42?currency=INR HTTP/1.1
Host: example.com
Accept: application/json
Cookie: session=…
  • GET is the method.
  • /products/42?currency=INR is the request target for this origin.
  • Host identifies the target host for HTTP/1.1 routing.
  • Accept states which response media types the client prefers.
  • Cookie can carry application session information.

A request can also have content, commonly called a body. Whether content is meaningful depends on the method and application. HTTP defines message meaning; the API defines what a particular path, field, or JSON property means for that application.

APIs and JSON takes that application contract as its starting point.

Anatomy of an HTTP response

A simplified response contains a status, fields, and optional content:

Illustrative HTTP/1.1 responsehttp
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: private, max-age=60

{"id":42,"name":"Illustrative product"}
  • 200 is the status code; OK is a human-readable reason phrase used in HTTP/1.1.
  • Content-Type says how to interpret the response content.
  • Cache-Control supplies caching directives.
  • The JSON after the blank line is the response content.

An HTTP response proves that an HTTP-speaking component answered. It does not always prove that the origin application ran. A cache, proxy, gateway, or load balancer may produce or reuse the response.

Methods, status codes, and headers

You do not need to memorize every HTTP method and status code to use the model:

  • GET retrieves a current representation of a target resource.
  • POST asks the target resource to process the enclosed representation according to its own semantics.
  • PUT requests that the enclosed representation create or replace state at the target.
  • DELETE asks the target to remove its association with current functionality.

Status-code classes provide a first orientation: 2xx indicates successful handling, 3xx redirects or supplies related control information, 4xx describes a problem associated with the client request, and 5xx describes the server being aware that it failed or could not perform the request. The exact code still matters.

For example, the historical name 401 Unauthorized can be confusing. The HTTP specification defines it as a request lacking valid authentication credentials for the target resource, along with an authentication challenge. A 403 Forbidden response instead says the server understood the request but refuses to fulfill it.RFC 9110 defines method and status-code semantics, including 401 and 403.2 Applications sometimes use these codes imprecisely, so combine the standard meaning with the API contract and server evidence.

Fields—often called headers—carry metadata and control information. They can describe content, authentication, caching, negotiation, origins, cookies, and much more. The field name alone does not guarantee that an intermediary or application honors it correctly.

What HTTPS protects

HTTPS protects HTTP application data while it travels between TLS endpoints. A passive observer between those endpoints should not be able to read the requested path, fields, or response content. An active network attacker should not be able to change protected content without detection. Certificate validation helps the client authenticate that it reached the service identity it requested.

This boundary can end at a reverse proxy or CDN. That intermediary may decrypt the request and establish a separate protected connection to the application. “Encrypted in transit” therefore requires asking: between which endpoints?

TLS also does not make all traffic characteristics invisible. IP endpoints and transport activity remain observable to networks carrying the packets, and TLS 1.3 does not hide the approximate length of protected records.RFC 8446 notes that TLS does not conceal record length.5 Newer mechanisms can protect some additional metadata, but HTTPS should not be described as total network anonymity.

What HTTPS does not protect

HTTPS does not guarantee that:

  • the application is honest or safe;
  • application code has no bugs;
  • the authenticated operator will handle data responsibly;
  • a logged-in user is authorized for a particular action;
  • the endpoint is free from malware;
  • data remains encrypted after a TLS endpoint decrypts it;
  • client or server devices are uncompromised.

A valid certificate proves a scoped identity relationship under certificate-validation rules. It is not an endorsement of the website’s content or business. Authorization, input validation, secure storage, dependency security, and monitoring remain separate responsibilities.

Common misconceptions

HTTP always uses TCP

HTTP/1.1 and HTTP/2 commonly use TCP. HTTP/3 uses QUIC, which is carried over UDP and supplies its own secure, reliable streams.

HTTPS replaces HTTP

HTTPS preserves HTTP request and response semantics while adding TLS protection to the communication path.

UDP makes HTTP/3 unreliable

UDP does not supply reliable delivery, but QUIC builds reliability, ordering within streams, congestion control, and security above UDP.

A valid certificate proves a website is trustworthy

Certificate validation helps authenticate the requested service identity. It does not audit application behavior, content, or intentions.

Debugging scenario

Debugging scenario

DNS resolves successfully. A connection attempt reaches the destination, but the browser reports that the certificate is not valid for the requested host.

Which layers are working? DNS returned usable destination information. IP routing reached a listening endpoint, and enough transport and TLS exchange occurred for that endpoint to present a certificate.

Where does the failure occur? During TLS service-identity validation. The browser compares the identity it intended to reach with identifiers presented in the certificate. RFC 9525 defines this reference-identifier matching model.See RFC 9525’s service-identity verification rules.8

Investigate whether DNS points to the intended endpoint, whether the correct certificate covers the requested hostname, and whether the proxy or server selected the correct virtual host and certificate. The ordinary protected HTTP request is generally not sent after this validation failure, so changing an application route or database query is unlikely to fix it.

Knowledge check

Reflect, then reveal each answer.

  1. What responsibility does TCP provide for common HTTP/1.1 and HTTP/2 traffic?

    TCP provides a connection-oriented, reliable, in-order byte stream. It does not assign HTTP meaning to those bytes.

  2. What does HTTP add above transport?

    HTTP defines request and response semantics: methods, targets, fields, content, status codes, and how those elements describe operations on resources.

  3. How does the HTTP/3 stack differ from the common HTTP/2 stack?

    HTTP/2 commonly uses TLS over TCP. HTTP/3 uses QUIC with integrated TLS, and QUIC packets are carried in UDP datagrams.

  4. Does HTTPS prove that an application is honest and bug-free?

    No. HTTPS authenticates an endpoint under the certificate model and protects data in transit. Application behavior, authorization, and code quality are separate concerns.

  5. DNS works and a server presents a certificate for the wrong hostname. Which boundary failed?

    TLS service-identity validation failed. DNS and basic reachability worked far enough to contact an endpoint, but the endpoint did not prove the identity the client requested.

What to learn next

Authentication and Sessions explains how applications interpret credentials carried over these protocol layers. Reverse Proxies, Logs, and Debugging Production Failures applies the same layer model to production evidence.

How this connects

  1. APIs and JSON

    Apply HTTP methods, targets, fields, status codes, and content to application contracts.

  2. Backend request processing

    Follow an accepted HTTP request through routing, validation, application logic, and a response.

  3. Authentication and authorization

    Understand how identity and permissions are represented above the secure transport layer.

  4. Reverse proxies and logs

    Trace where TLS terminates and which HTTP-speaking component produced a failure response.

Key takeaway

Diagnose from the bottom up: naming chooses a destination, transport establishes communication, TLS protects it, HTTP describes the exchange, and application code decides what the request means.

References & further reading

References & further reading8 sourcesPrimary standards and official documentation used for this lesson.
  1. RFC 9293: Transmission Control Protocol (TCP) (opens in a new tab)

    Internet Engineering Task Force (IETF)

    Reliable byte streams, connection establishment, ordering, and retransmission

  2. RFC 9110: HTTP Semantics (opens in a new tab)

    Internet Engineering Task Force (IETF)

    HTTP methods, request and response semantics, fields, and status codes

  3. RFC 9112: HTTP/1.1 (opens in a new tab)

    Internet Engineering Task Force (IETF)

    HTTP/1.1 message syntax and use of TCP connections

  4. RFC 9113: HTTP/2 (opens in a new tab)

    Internet Engineering Task Force (IETF)

    HTTP/2 framing, streams, and TLS and TCP usage

  5. RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3 (opens in a new tab)

    Internet Engineering Task Force (IETF)

    TLS authentication, confidentiality, integrity, and handshake behavior

  6. RFC 9114: HTTP/3 (opens in a new tab)

    Internet Engineering Task Force (IETF)

    HTTP semantics over QUIC

  7. RFC 9000: QUIC — A UDP-Based Multiplexed and Secure Transport (opens in a new tab)

    Internet Engineering Task Force (IETF)

    QUIC streams, integrated TLS, reliability, and UDP datagrams

  8. RFC 9525: Service Identity in TLS (opens in a new tab)

    Internet Engineering Task Force (IETF)

    Matching a requested service identity against certificate identifiers

Return to the learning path