TECHNOLOGY

Use Expect before uploading large inference payloads

In this article
THE QUICK TAKE

An interim Continue response permits an upload; only the final response establishes its HTTP result.

An image request can fail authentication only after the client has spent time uploading its payload. Before changing the model server, check whether the HTTP client and every intermediary can make an early decision from the request headers. An expectation handshake can avoid some wasted transfer, but it also introduces a point where a poorly configured proxy can leave both sides waiting.

What the expectation changes

Expect: 100-continue asks the recipient to indicate whether sending the body is worthwhile. The interim response permits upload; it does not confirm that a model accepted the input, that decoding succeeded, or that capacity was reserved. Keep the final response as the operation result. A client parser that returns on the interim message can report success while the upload has not even begun.

Construct a bounded test

Use a small synthetic body with the same media type and authorization path as the problematic request. Record header transmission, the interim response if present, the first body byte and the final status. Compare the public endpoint with an authorized internal test route when one exists. This separates a proxy that generates the interim response from an origin that actually examines the headers. Do not put real credentials into packet-capture notes.

Diagnose a waiting upload

If neither side advances, inspect the expectation timeout in the HTTP library and buffering behavior at the gateway. The origin must not wait for the complete body before responding to this expectation. A client may proceed without waiting indefinitely, so observing a successful upload does not prove that the handshake worked. Conversely, no interim message is needed when a recipient can immediately send the final rejection.

Choose the fallback deliberately

An expectation failure can justify repeating the request without that expectation when the protocol and application permit it. Preserve the body and relevant request headers, but retain the ordinary retry controls for generation. A connection break after upload starts creates a different question: the application may already have admitted work. The handshake does not supply an idempotency key or establish duplicate suppression. Log attempt identity separately from any eventual generation identity.

A header-only rejection should also leave an audit record that distinguishes refused upload from admitted work. If the gateway logs the interim message as the request outcome, its success counts can rise even while the origin rejects every payload. Check which response the access-log status field represents.

Define the useful outcome

Accept the change when invalid requests are rejected before substantial body transfer and valid uploads still reach a final response. Include a path that accepts headers but rejects malformed decoded content; this demonstrates the limited scope of early validation. Compare transferred bytes and elapsed upload time in that test rather than promising faster inference. Once the body reaches the service, tokenization, model scheduling and output delivery continue under their own budgets.

Primary references

HTTP Semantics. Defines Expect handling and interim versus final responses.

HTTP/1.1. Explains request framing and connection handling while a body is pending.

Problem Details for HTTP APIs. Provides a structured format for a final API rejection after early header checks.

Related reading: HTTP body limits and token limits: separate inference API checks; Retrying generation POSTs: idempotency must be explicit.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles