Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Add support for Save-Data request header #1258

Closed

Description

@igrigorik

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.

Activity

  1. huibaolin commented on Feb 8, 2016

    @huibaolin
    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.

  2. igrigorik commented on Feb 8, 2016

    @igrigorik
    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?
  3. huibaolin commented on Feb 8, 2016

    @huibaolin
    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".
  4. jeffkaufman commented on Mar 7, 2016

    @jeffkaufman
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions