HTTP Headers
Early Data
The HTTP Early-Data
request header is set by an intermediary to indicate that the request has been conveyed in TLS early data, and also indicates that the intermediary understands the 425 Too Early
status code.
If a client has interacted with a server recently, early data (also known as zero round-trip time (0-RTT) data allows the client to send data to a server in the first round trip of a connection, without waiting for the TLS handshake to complete.
This reduces latency for repeat connections between a client and server, but has security implications, as early data is susceptible to replay attacks.
The Early-Data
header is not set by the originator of the request (i.e., a browser).
Syntax
To send early data in an HTTP request, include the header "Early-Data" with a value of 1.
Directives
A GET request with an Early-Data header
A client that wants to use early data can send HTTP requests immediately after initiating the TLS handshake with the server. When sending a request in early data, the client is indicating its willingness to retry the request if it receives a 425 Too Early
status code, so the Early-Data
header is omitted in such requests.
For example, a client can send a simple GET request like this:
GET /resource HTTP/1.1
Host: example.com
An intermediary that forwards a request before the TLS handshake is complete can include the Early-Data
header set to 1
to indicate early data transmission:
GET /resource HTTP/1.1
Host: example.com
Early-Data: 1
How to Modify Header using Requestly
Requestly is a powerful Chrome extension that allows you to modify HTTP headers, including the Early Data header. This can be very useful for developers who want to test how their applications handle early data protocols or troubleshoot related issues. Steps to Modify the Early Data Header:
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter Early-Data.
- In the “Header Value” field, enter the desired value (e.g., 1 to indicate early data usage).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
- Save the rule.
Once set up, Requestly will add or override the Early-Data header in all matching requests, helping you simulate early data interactions and test how your server handles them. You might need to modify the Early Data header to test or debug features that depend on early data transmission, which can improve performance by sending data before a full TLS handshake completes. This helps ensure your application works correctly in these scenarios.
Table of Contents
- No headings found.