HTTP Headers
Save Data
Experimental: This is an experimental technology
Carefully review the Browser compatibility table before deploying this in production environments.
The HTTP Save-Data
request header is a network client hint that communicates the client’s preference for conserving data usage.
This preference might be driven by factors such as high transfer costs, limited bandwidth, or slow network speeds.
Save-Data
is a low entropy hint, meaning it may be sent by the client even if the server has not explicitly requested it through an Accept-CH
response header.
Additionally, it should be utilized to decrease the data sent to the client regardless of other network capability hints like Downlink
and RTT
.
A value of On
signifies that the user has explicitly chosen to enable reduced data consumption mode on their device.
Web servers receiving this signal can respond with optimized content, such as smaller images and videos, simplified markup and styles, disabled polling, and automatic updates, aimed at minimizing data transfer.
Note:
Disabling HTTP/2 Server Push (RFC 7540, section 8.2: Server Push) can lead to decreased data downloads.
Be aware that most modern browsers have ceased supporting this feature by default.
Header type | Request header, Client hint |
---|---|
Forbidden request header | No |
CORS-safelisted response header | No |
Syntax
Save-Data: <sd-token>
Directives
Directives
- <sd-token>
A value indicating whether the client wants to opt in to reduced data usage mode.
on
indicates yes, whileoff
(the default) indicates no.
Example
Using Save-Data: on
The following message requests a resource with the Save-Data header indicating the client is opting in to reduced data mode:
GET /image.jpg HTTP/1.1
Host: example.com
Save-Data: on
The server responds with a 200 response, and the Vary header indicates that Save-Data may have been used to create the response, and caches should be aware of this header to differentiate responses:
HTTP/1.1 200 OK
Content-Length: 102832
Vary: Accept-Encoding, Save-Data
Cache-Control: public, max-age=31536000
Content-Type: image/jpeg
[…]
Omitting Save-Data
In this case, the client requests the same resource without the Save-Data header:
GET /image.jpg HTTP/1.1
Host: example.com
The server’s response provides the full version of the content.
The Vary header ensures that responses should be separately cached based on the value of the Save-Data header.
This can ensure that the user is not served a lower-quality image from the cache when the Save-Data header is no longer present (e.g., after having switched from cellular to Wi-Fi).
HTTP/1.1 200 OK
Content-Length: 481770
Vary: Accept-Encoding, Save-Data
Cache-Control: public, max-age=31536000
Content-Type: image/jpeg
[…]
How to Modify Header using Requestly
- 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 Save-Data.
- In the “Header Value” field, enter on or off, depending on what state you want to simulate.
- 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 inject the Save-Data: on header into all matching requests, allowing you to test how your application adjusts its content and data usage for users who prefer to save data.
Table of Contents
- No headings found.