Core Concepts

Request Path

Follow a short-link click from the browser to the server that returns the redirect.

Free~13 min

An HTTPS request travels from the client to the service that can answer it. The client needs an address for the hostname and a secure connection to that address. The edge, the service's public entry point, can then route the request to an application server. Tracing those steps helps locate a failure.

Find an address for the name

Follow a click on https://go.example/a7Kp2Qx through a URL shortener. The browser separates the hostname go.example from the path /a7Kp2Qx. The Domain Name System (DNS) can supply an address for the hostname. The path arrives later in the HTTP request and gives the shortener the code to look up.

With no usable local answer, the client asks a recursive resolver, a server that looks up DNS records on the client's behalf. The resolver can answer from a cache. On a miss, it locates the authoritative name server, which publishes the domain's records. It can follow referrals from the root and parent name servers when it has yet to learn which server to ask. In this example the resolver already knows where the domain's records are published.

Suppose the answer is 203.0.113.10 with a time to live (TTL) of 60 seconds. In the normal lookup shown here, the resolver can use that cached answer for up to 60 seconds. It can respond with .10 after the published address changes to .20. A client using an open connection can keep using it independently of the DNS cache.

A DNS record can give clients different addresses in different locations. Its answers are cached and can be shared by many clients. To see why a request reached one particular application instance, inspect the routing after the connection reaches the service.

DNS concepts and caching · DNS terminology

Open a secure connection to the edge

The browser opens a connection to the address. In this example, TCP (Transmission Control Protocol) carries the bytes for HTTP/1.1. The browser then uses TLS (Transport Layer Security) to encrypt the connection and verify the server's identity. In this full handshake, the edge presents a certificate. The browser verifies that it comes from a trusted issuer and matches the original hostname, go.example. It then sends the protected HTTP request.

The edge is the first server in our service that handles the web connection. In this design it terminates TLS, which means the browser's encrypted connection ends there and the edge can read the HTTP message. It can use a separate encrypted connection to the backend. The browser's TLS covers its own connection to the edge.

A deployment can also pass encrypted traffic through to a backend that performs the TLS handshake. In that arrangement the forwarding hop can route using connection information. Routing based on the HTTP path happens where a component can read that path.

TLS 1.3 handshake · Checking the service's identity

Route the request

The edge handles the public side of the connection on behalf of the service. It forwards the HTTP request to an application server and carries the response back. In that role, it is a reverse proxy. A forward proxy acts on the client's behalf. For example, a company can configure its employee browsers to use a proxy for outbound traffic.

Our edge can also act as an API gateway. It matches host go.example, method GET, and the short-code path to the redirect service. A separate route can match POST /v1/links for link creation. If we add account-based creation, the gateway can require a credential and check the account's policy before forwarding the request. The redirect handler still resolves the code and decides which destination or error to return.

The route first selects the redirect service. A load balancer can then choose one eligible instance, such as API B, from the service's group of servers. The same edge can make both choices. In another deployment they can happen in separate components. Load Balancing covers how to choose a target and how to take one out of service.

The backend's direct connection comes from the reverse proxy. If the application needs the original host or client address, have the edge remove caller-supplied forwarding values and create its own. Configure the application to accept those values only through the trusted proxy boundary.

HTTP intermediaries · Trusting forwarded information

Return the redirect

API B looks up a7Kp2Qx. The URL Shortener design can use a cached copy of the mapping and consult its database when the cache has no copy. API B returns 302 with a Location header containing https://example.com/spring. The response travels back through the edge. The browser follows the location with a new request to the destination.

HTTP 302 and the Location header

Find where the request stopped

Start at the first boundary with no evidence of success. Operate on one request if possible. When both edge and application have a request ID, compare their records for that ID to see which route and target the edge chose.

What you observeWhat to check next
The client cannot get an addressCheck the resolver's response and which address the authoritative server publishes.
The browser receives a certificate errorCheck the hostname in the URL, the address the browser reached, and the certificate presented there.
The edge returns a route error and never forwards the requestCheck which host, method, and path its rules received.
The edge returns 504The proxy could not get a timely response from a required upstream server. Check whether the application received the request and what it was waiting on.
The shortener returns 302 but the browser shows an errorInspect the browser's request to the destination. It has its own response or connection failure.

HTTP 504 semantics

See also

Used in

  • URL Shortener - the create and redirect routes lead to a stateless API that resolves the code and sends back a 302.
  • ChatGPT - the chat gateway receives the message submission and exposes a separate reply-stream URL the browser calls afterward.

Done reading? Mark it so it sticks in your dashboard.

Discussion