New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for `Save-Data` request header #1258

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

Comments

Projects
None yet
3 participants
@igrigorik

igrigorik commented Feb 8, 2016

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

This comment has been minimized.

Contributor

huibaolin commented Feb 8, 2016

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

This comment has been minimized.

igrigorik commented Feb 8, 2016

@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

This comment has been minimized.

Contributor

huibaolin commented Feb 8, 2016

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 added a commit that referenced this issue Mar 7, 2016

Add support for the Save-Data client hint.
Fixes #1258

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

This comment has been minimized.

Contributor

jeffkaufman commented Mar 7, 2016

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

@jeffkaufman jeffkaufman closed this Mar 7, 2016

jeffkaufman added a commit that referenced this issue Mar 7, 2016

jeffkaufman added a commit that referenced this issue Mar 9, 2016

Add support for the Save-Data client hint.
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 added a commit that referenced this issue Mar 9, 2016

Add support for the Save-Data client hint.
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 added a commit that referenced this issue Mar 11, 2016

Add support for the Save-Data client hint.
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 added a commit that referenced this issue Mar 11, 2016

Add support for the Save-Data client hint.
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 added a commit that referenced this issue Mar 11, 2016

Add support for the Save-Data client hint.
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 join this conversation on GitHub. Already have an account? Sign in to comment