Skip to content

Enabling WebP Compression on CDN

You can configure the level of WebP compression by setting VSHCDN-WEBP-QUALITY header on the backend. The accepted values are between 1 and 100.  If it falls outside this range, the CDN will use the default value of 80. To set the level of compression to 90%, you can configure the header in Nginx as following:

add_header VSHCDN-WEBP-QUALITY 90;

The CDN will use the new setting when if fetches the image, usually after if expires from the cache. You can selectively purge it in the CDN administration interface.

The setting will be ignored if the image is already in WEBP format, in this case the original image is always sent to the client.

Limits for conversion to WebP

The following limits are set in imgproxy for autoconversion to WebP:

  • IMGPROXY_READ_TIMEOUT=10
  • IMGPROXY_WRITE_TIMEOUT=10
  • IMGPROXY_DOWNLOAD_TIMEOUT=5
  • IMGPROXY_MAX_SRC_RESOLUTION=30.0

Other limits are set to default values, which can be found in imgproxy documentation