🎉 Requestly joins BrowserStack to build the future of application testing. Read more

HTTP Headers

ECT

HTTP Header

The HTTP ECT request header is used in Client Hints to indicate the effective connection type: slow-2g, 2g, 3g, or 4g.

The value represents the “network profile” that best matches the connection’s latency and bandwidth, rather than the actual mechanisms used for transferring the data.
For example, 2g might be used to represent a slow Wi-Fi connection with high latency and low bandwidth, while 4g might represent a fast fibre-based broadband network.

The hint allows a server to choose what information is sent based on the broad characteristics of the network. For example, a server might choose to send smaller versions of images and other resources on less capable connections. The value might also be used as a starting point for determining what information is sent, which is further refined using information in RTT and Downlink hints.

Syntax

ECT: <value>

Directives

Value indicating the effective connection type. It can be one of the following: slow-2g, 2g, 3g, or 4g.

Example

A server must first opt in to receive the ECT header by sending the Accept-CH response header containing ECT.

For example, the server responds with:

Accept-CH: ECT

Then, on subsequent requests, the client might include an ECT header:

ECT: 2g

How to Modify Header using Requestly

Requestly is a powerful Chrome extension that allows you to modify HTTP headers, including the ECT header. This is especially useful for testing how your application responds to different network conditions or optimizations during development or debugging. Steps to Modify the ECT Header:

  1. Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
  2. Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
  3. Add a new header modification:
    • Under “Action”, select “Add” or “Override”.
    • In the “Header Name” field, enter ECT.
    • In the “Header Value” field, enter the desired network condition value (e.g., 4g).
  4. Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
  5. Save the rule.

Once set up, Requestly will inject the ECT: 4g header into all matching requests, allowing you to simulate different effective connection types and test how your app behaves under varying network conditions.

Modifying the ECT header helps you mimic different network speeds and qualities, so you can ensure your app performs well whether users are on fast or slow connections.