Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Add support for Save-Data request header #1258

Closed
igrigorik opened this issue Feb 8, 2016 · 4 comments
Closed

Add support for Save-Data request header #1258

igrigorik opened this issue Feb 8, 2016 · 4 comments

Comments

@igrigorik
Copy link

https://httpwg.github.io/http-extensions/client-hints.html#the-save-data-hint

When the Save-Data header is present, PageSpeed should automatically adjust its filters and optimizations to reduce the amount of served bytes -- e.g. compress images with lower quality. Ideally, this should be an "on by default" behavior, but one that can be (re)configured by the site owner.

@huibaolin
Copy link
Contributor

To support Save-Data, we'll add 2 new quality levels:

  • WebpQualityForSaveData
  • JpegQualityForSaveData

To enable this feature, and also make the optimized friendly to CDN/proxy, we'll add a new option:

  • AllowVaryOn.

AllowVaryOn will list the headers which the optimized images can vary on. Currently it will support these: Accept, User-Agent, and Save-Data. It can also be "Auto" by which PageSpeed will pick the proper list of header depends on whether the request has Via header or not.

@igrigorik
Copy link
Author

@huibaolin great stuff, thanks! A couple of followup questions:

  • What will the default quality values be for *SaveData settings?
  • Will AllowVaryOn be on by default? If not, what stops us from turning it on by default?
@huibaolin
Copy link
Contributor

WebpQualityForSaveData will be defaulted to 50, which is the quality used in Chrome Data Saver. JpegQualityForSaveData will be set to match WebP 50. I'll run some experiments to find out the exact value.

AllowVaryOn will be defaulted to "Auto". By "Auto" we'll try to use the most meaningful value for the user.

  • If the request has a "Via" header, we assume that it was through a CDN/proxy, so we will allow varying on "Accept" and "Save-Data" headers.
  • Otherwise, we assume that the request was from the user agent directly. We'll try all images formats supported by the UA, and will allow "User-Agent" and "Save-Data".
jeffkaufman pushed a commit that referenced this issue Mar 7, 2016
Fixes #1258

Squash-merge of huibao's work in 1fef4a, e68644, 5da54d, 6c0be2, b98bf9,
79eb6f, c0b22d, and b92ddc.
@jeffkaufman
Copy link
Contributor

Fixed by 1fef4af, e686449, 5da54d8, 6c0be2e, b98bf9a, 79eb6fa, c0b22d1, and b92ddc1. Squash-merged these to 408b027 for the 1.11 release.

jeffkaufman pushed a commit that referenced this issue Mar 7, 2016
jeffkaufman pushed a commit that referenced this issue Mar 9, 2016
Fixes #1258

Squash-merge of huibao's work in 1fef4af, e686449, 5da54d8, 6c0be2e,
b98bf9a, 79eb6fa, c0b22d1, and b92ddc1.

Changes nullptr to NULL to support older compilers.
jeffkaufman pushed a commit that referenced this issue Mar 9, 2016
Fixes #1258

Squash-merge of huibao's work in 1fef4af, e686449, 5da54d8, 6c0be2e,
b98bf9a, 79eb6fa, c0b22d1, and b92ddc1.

Changes nullptr to NULL to support older compilers.
jeffkaufman pushed a commit that referenced this issue Mar 11, 2016
Fixes #1258

Squash-merge of huibao's work in ad2818b, 83c9607, 1fef4af, e686449,
5da54d8, 6c0be2e, b98bf9a, 79eb6fa, c0b22d1, and b92ddc1.

Also:
 * Changes nullptr to NULL to support older compilers.
 * Fixes missing equals sign in kOptimizedImageInfoList definition
jeffkaufman pushed a commit that referenced this issue Mar 11, 2016
Fixes #1258

Squash-merge of huibao's work in ad2818b, 83c9607, 1fef4af, e686449,
5da54d8, 6c0be2e, b98bf9a, 79eb6fa, c0b22d1, b92ddc1, and f3959c5.

Also:
 * Changes nullptr to NULL to support older compilers.
 * Fixes missing equals sign in kOptimizedImageInfoList definition

Export more files for image resizing
jeffkaufman pushed a commit that referenced this issue Mar 11, 2016
Fixes #1258

Squash-merge of huibao's work in ad2818b, 83c9607, 1fef4af, e686449,
5da54d8, 6c0be2e, b98bf9a, 79eb6fa, c0b22d1, b92ddc1, f3959c5, 77fa0e5,
and 275e0cd.

Also:
 * Change nullptr to NULL to support older compilers.
 * Fix missing equals sign in kOptimizedImageInfoList definition
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants