Add Etags

PageSpeed Service was turned off on August 3rd, 2015. Please see Turndown Information for PageSpeed Service.

Objective

Reduce payload size by utilizing ETags to send back a 304 Not Modified response.

PageSpeed rule

This rewriter implements the PageSpeed rule for minimizing payload size.

Description

All responses served by PageSpeed Service have an associated ETag that identifies the content hash of the response. If a browser uses the If-None-Match header to pass this ETag value in a subsequent request to the PageSpeed Service servers, the servers respond with a 304 Not Modified response if the content has not changed. In case of private responses, the PageSpeed Service servers will contact the reference domain servers to get the fresh content and then compare the computed ETag values to decide whether to serve a fresh response or a 304. This feature significantly reduces the number of bytes downloaded in repeat views of a page and in cases where the same resource is requested across different pages of the same website.

Operation

PageSpeed Service adds the ETag header with the response content hash to all responses served by the service.

Example

The effect of this rewriter on an example resource can be observed by viewing the headers for the downloaded image in this example page. An Etag header with value 09bab05588df1fe22c73215e84f492ac can be found in the image response. If you refresh the page (by pressing the Refresh button on your browser), you will see a 304 Not Modified response in most browsers.