Oblivious HTTP Relay and Gateway Architecture Explained

Updated on
10 min read

An ordinary HTTP service can often associate a request with the network address that sent it. A proxy that can read the forwarded HTTP message may see both the client connection and its contents; end-to-end TLS can hide those contents from a proxy that does not terminate TLS. Oblivious HTTP (OHTTP) is a protocol for selected application requests that divides those views between two intermediaries. This explainer is for developers, privacy engineers, and network operators evaluating how the relay and gateway architecture works, what it protects, and where its trust assumptions remain.

What Is Oblivious HTTP?

Oblivious HTTP is an IETF protocol for sending an encrypted HTTP request through an Oblivious Relay to an Oblivious Gateway. The client encrypts the request for the gateway. The relay forwards the encrypted message but cannot read its HTTP contents; the gateway decrypts and handles the request but does not receive the client’s network connection directly. The protocol is specified in RFC 9458.

The gateway can pass the decoded request to a target resource, such as an application endpoint. The target may be a separate service or part of the gateway itself. The gateway is trusted with the request contents and can influence the response, so OHTTP does not create end-to-end encryption from the client to an independent target. Instead, it aims to prevent one intermediary from routinely seeing both the client’s network identity and the request payload.

OHTTP is not a setting that encrypts every browser request. An application must deliberately create an OHTTP request, use a relay and gateway that support the protocol, and handle the response. It is most suitable for discrete requests that do not need to carry a continuing user session.

The Problem OHTTP Solves

Encryption protects message contents in transit, but a server normally sees the source address of its incoming connection. That address, connection reuse, and request timing can help associate multiple requests with one client. A standard forward proxy changes which address the destination sees, but it can become a point that knows both the client’s address and the traffic it forwards. With TLS to the destination, a proxy that cannot decrypt the TLS payload also cannot perform application-level forwarding in the usual way.

OHTTP separates these observations. A relay accepts the client’s connection and forwards ciphertext to a gateway. The gateway receives the request content after decrypting it, but its incoming connection is from the relay. The design is useful when an application wants to reduce the ability of a service to associate a request with a client’s network address without asking the relay to read the request.

This is a narrower goal than anonymity. The relay still sees a client connection, and the gateway still handles the request. Their cooperation, shared logs, or identifying information inside the request can reconnect those facts.

How the Relay and Gateway Architecture Works

Before sending a request, a client needs an authenticated, integrity-protected key configuration for its gateway. The configuration identifies the gateway’s public key and supported HPKE algorithms. RFC 9180 defines Hybrid Public Key Encryption (HPKE), the encryption scheme OHTTP uses to protect messages. RFC 9458 defines the key format, but leaves how clients obtain that configuration to the application or deployment.

The request path is:

Client
  | 1. Encode HTTP request and encrypt it for the gateway
  v
Oblivious Relay
  | 2. Forward ciphertext to its configured gateway
  v
Oblivious Gateway
  | 3. Decrypt request and send it to the target resource
  v
Target Resource
  | 4. Return response through the gateway
  v
Gateway -> Relay -> Client
       encrypted response

In more detail, the client encodes an HTTP message using Binary HTTP, then uses HPKE and the gateway’s public key to create an encapsulated request. The client sends that body to the relay, which forwards it to the gateway. The gateway decrypts the request, handles it or forwards it to the target, and encrypts the response for the client. The relay forwards that response without decrypting it. RFC 9292 specifies Binary HTTP, the compact message format used by OHTTP.

Participant Normally learns Does not receive from the protocol
Client Request and response; relay and gateway configuration —
Relay Client connection address, gateway destination, timing, sizes, and ciphertext Plaintext HTTP request and response
Gateway Decrypted request and response; relay connection address Client’s original network connection address
Target resource Request delivered by the gateway and its response Original client address, unless application data or forwarded headers reveal it

OHTTP uses a one-to-one mapping between a relay resource and a gateway resource. This makes the relay’s forwarding role predictable, but it does not make the relay invisible: it can still observe who connected and when. A gateway can also identify a person through cookies, account credentials, unique request values, or other application data even though it does not see the original IP address.

Each transaction takes more work than a direct request: the client constructs an encrypted message, the relay forwards it, and the gateway decrypts and processes it before returning an encrypted response. Connections can be reused between the client and relay and between relay and gateway, but the extra hop, message expansion, and cryptographic work can still affect latency and resource use.

Components and Key Concepts

Client and gateway key configuration: The client needs the gateway’s public key and supported algorithms. A client must obtain that information through a trusted, integrity-protected process; accepting an attacker-selected key would let that party decrypt requests. Key rotation and discovery are deployment responsibilities, not a universal URL or discovery mechanism specified by OHTTP.

Oblivious Relay: The relay receives the client’s connection and routes the encapsulated message to its paired gateway. It must not be able to decrypt the payload. Its access logs and traffic records are still sensitive because they can identify client addresses and request timing.

Oblivious Gateway: The gateway holds the private key, decrypts the request, and produces the response. Because it sees request contents, it is not an untrusted end-to-end intermediary. It needs controls on which target resources it may access, how it handles malformed requests, and what it records.

Target resource: This is the service that handles the ordinary HTTP request after the gateway decrypts it. The target can see application-level identifiers and the gateway’s outgoing network connection. It should not be assumed that the target is cryptographically isolated from the gateway.

HPKE and Binary HTTP: HPKE encrypts the request to the gateway’s public key; Binary HTTP supplies the encoded request and response format. The IETF OHAI working-group repository maintains the protocol’s working materials, while the Rust OHTTP implementation provides a reference library and sample client and server.

Real-World Use Cases

OHTTP is appropriate when an application sends information that is useful to a service but should not automatically be tied to the client’s network address. Examples include privacy-sensitive telemetry, anonymous surveys, search queries, and requests for location-specific data. The application still has to decide whether those requests can function without cookies, account identity, or a persistent session.

DNS queries are another possible application, but OHTTP is not a replacement transport for ordinary DNS. DNS over HTTPS and DNS over TLS protect a client-to-resolver DNS exchange; OHTTP instead splits observations for supported HTTP requests between a relay and gateway. The two designs address different points in a request path.

OHTTP is generally a poor fit for interactive sessions that depend on the service recognizing one user across many requests, or for content that inherently identifies the user. It also requires application changes and cooperating infrastructure, so it is not a universal proxy for existing web traffic.

Getting Started: Evaluate an OHTTP Deployment

Start by confirming that the request can be handled without a client identity or cross-request state. Then select a client library and compatible relay and gateway; do not implement HPKE or Binary HTTP by hand. For example, the Rust reference repository includes a library and test client and server. Its sample server combines gateway and target roles and does not provide a relay, so a direct request to that sample does not hide the client’s address.

Clone the reference implementation and run its component tests:

git clone https://github.com/martinthomson/ohttp.git
cd ohttp
cargo test -p ohttp -p ohttp-client -p ohttp-server

This checks the local reference implementation; it does not test a production relay, key-discovery system, or complete deployment. For application integration, follow the selected library’s API and pin a reviewed version rather than treating a test sample as a turnkey service.

Key configuration delivery is deployment-specific. If the gateway publishes its configuration over HTTPS, RFC 9458 identifies the serialized collection with the application/ohttp-keys media type. Set OHTTP_KEYS_URL to the actual endpoint documented by the selected service, then inspect the response:

curl --fail --show-error --silent \
  --header 'Accept: application/ohttp-keys' \
  --dump-header - \
  --output ohttp-keys.bin \
  "$OHTTP_KEYS_URL"

Confirm that the response is successful and has the expected media type, then parse and authenticate the key configuration using the OHTTP client implementation. A successful curl request alone does not prove that the bytes are valid, that the key belongs to the intended gateway, or that an OHTTP request can be completed.

Before production use, verify the full path with a test client and a test target. Confirm that the relay forwards the encapsulated body, the gateway can decrypt it and return a response, and the client can decrypt that response. Review relay and gateway logs separately, remove unnecessary identifiers and forwarded client-address headers, and test key rotation, malformed messages, timeouts, rate limits, and target restrictions. If requests fail, check that the client and gateway agree on the key identifier and HPKE algorithms, that the relay points to the correct gateway, and that both sides use the expected OHTTP media types.

Common Misconceptions

“The relay cannot learn anything about the client.”

The relay sees the client’s network connection and can observe timing, message sizes, and the gateway it contacts. OHTTP hides the encapsulated HTTP contents from the relay; it does not hide the fact that a client contacted the relay.

“The gateway cannot identify the user.”

The gateway does not receive the client’s original connection address through the OHTTP flow, but it sees the decrypted request. Cookies, authorization headers, unique payloads, and application behavior can identify or correlate a user. The gateway can also correlate requests through its own logs.

“OHTTP is end-to-end encryption or a VPN.”

The client encrypts the request to the gateway, not to an independent target resource. The gateway can read the message and determine how it is handled. OHTTP is also opt-in for supported application requests; it does not tunnel all device traffic like a VPN.

“Separate relay and gateway names guarantee privacy.”

If relay and gateway operators collude, share identifying logs, or can link traffic by timing and size, the intended separation can weaken. Independent administration, data minimization, and careful handling of application identifiers are part of the deployment’s privacy model, not automatic properties supplied by encryption.

External Resources

Changelog

  • 2026-11-25: First published.
TBO Editorial

About the Author

TBO Editorial writes about the latest updates about products and services related to Technology, Business, Finance & Lifestyle. Do get in touch if you want to share any useful article with our community.