7 Nov 2026 · 6 min read · EN
LiteSpeed Cache: WebP and AVIF — what it does, how to enable, queues and cache risks
Step-by-step: enable WebP or AVIF in the LiteSpeed Cache plugin, requeue images, test browser negotiation, and avoid cache fragmentation when using Vary or Client Hints.
By Tim Gocelerus
Problem
You want LiteSpeed Cache to generate and serve WebP or AVIF but aren’t sure what the plugin does, how to enable it, how processing is queued, or what caching risks to watch for when you add Vary or Client Hints.
What LiteSpeed Cache actually does for next‑gen images
- The plugin can optimize JPG/PNG originals, generate next‑generation formats (WebP or AVIF) and replace the served image URLs so supported browsers receive WebP/AVIF instead of the original file.
- Image Optimization runs as a QUIC.cloud–hosted service invoked from the plugin; the plugin sends optimization requests to QUIC.cloud rather than converting every file locally.
This means conversion and URL replacement are two separate steps: conversion (QUIC.cloud) produces the WebP/AVIF files, and replacement makes browsers request those files when appropriate.
Enable WebP or AVIF (step by step)
- In WordPress go to Dashboard → LiteSpeed Cache → Image Optimization → Image Optimization Settings.
- Find "Next‑Gen Image Format" and choose WebP or AVIF, then Save Changes.
- After changing the format use Image Optimization → Image Optimization Summary → Optimization Tools → "Soft Reset Optimization Counter" to restart the scan without re‑optimizing originals already converted.
- Trigger processing by using the Auto Request Cron (if enabled) or the "Send Optimization Request" button in the Image Optimization Summary.
Notes:
- The Image Optimization feature is a QUIC.cloud service invoked from the plugin; the plugin queues requests to that service for conversion.
- If you change the Next‑Gen setting later, follow the same soft reset + requeue sequence so the plugin rescans the library for files to convert.
How the queue and processing behave (practical view)
- When you request optimizations, the plugin submits jobs to the QUIC.cloud image conversion queue. The plugin’s UI shows counts and statuses for queued and completed items.
- Use "Soft Reset Optimization Counter" when switching formats to tell the plugin to scan again without reprocessing already‑optimized originals.
- You start work from the Image Optimization Summary with either the Auto Request Cron or the "Send Optimization Request" button.
Which image files get replaced
- The replacement mechanism focuses on raster images — jpg/jpeg, png and gif — and skips vector or icon formats such as svg/ico/bmp. That extension check is part of the plugin’s media handling.
- Because only these source types are processed and replaced, expect SVG and similar files to remain untouched.
Testing browser negotiation locally
Use curl to check what your site responds with for different Accept headers. Replace the URL with a real image URL on your site.
# Ask for AVIF first
curl -I -H "Accept: image/avif,image/webp,image/*" https://example.com/wp-content/uploads/2025/01/photo.jpg
# Ask for WebP
curl -I -H "Accept: image/webp,image/*" https://example.com/wp-content/uploads/2025/01/photo.jpg
# Ask for only older formats
curl -I -H "Accept: image/jpeg,image/png,image/*;q=0.9" https://example.com/wp-content/uploads/2025/01/photo.jpg
Check the response headers for Content-Type and any Vary headers to confirm the server is returning the format you expect.
Client Hints, Accept negotiation and cache keys — the essentials
- Browsers advertise supported image formats in the Accept request header. If your origin chooses a response based on Accept (for example, returning AVIF when Accept includes image/avif), downstream caches must not mix variants.
- RFC 8942 requires that when a server adapts responses based on Client Hints and the resource is cacheable, the server MUST include a Vary header naming the hints that determined the response.
- For Client Hints, a common server pattern is to send an Accept-CH response header to request hints and also include Vary on responses that are actually different. Example header pair:
Accept-CH: Sec-CH-Viewport-Width, Sec-CH-Width, Sec-CH-ECT
Vary: Sec-CH-Viewport-Width, Sec-CH-Width, Sec-CH-ECT
- Accept-CH only works in secure contexts (HTTPS) and user agents persist the opt‑in for the origin for the browser session.
Practical caching advice — avoid destroying cache efficiency
- The Vary header tells caches which request headers to use when building the cache key. Each added header increases the number of cache variants; headers with many possible values (like User-Agent, RTT, Downlink) can fragment cache hits severely.
- Prefer stable or coarse buckets if you must vary. For responsive images, the relatively stable hints are Sec-CH-Viewport-Width and Sec-CH-Width for geometry and Sec-CH-ECT for a coarse network bucket. Avoid high‑cardinality or rapidly changing numeric hints such as Sec-CH-Downlink or Sec-CH-RTT unless you accept heavy fragmentation.
- If you use Accept header content negotiation (Accept: image/avif, image/webp, ...), you must return Vary: Accept so caches keep separate AVIF and non‑AVIF objects.
- Note: some CDNs and reverse proxies do not automatically key on Accept or Client Hints unless you enable a specific feature (for example, a "Vary for images" option). Check your CDN or edge cache documentation and enable any image/Accept-keying feature if you serve multiple formats at the edge.
Fallbacks and safety
- Always keep original JPEG/PNG files as fallback on the origin. Delivery of WebP/AVIF is negotiation‑based (Accept header or Client Hints), so caches must preserve correct variants; misconfiguration can cause a client that doesn’t support a format to receive an unsupported one.
- After enabling next‑gen formats and conversions, test from multiple clients and networks, and use curl checks above to confirm both format negotiation and Vary headers behave as intended.
Summary and a hosting note
LiteSpeed Cache uses QUIC.cloud image optimization to convert originals and then replaces URLs so supported browsers receive WebP or AVIF. Enable the format in Dashboard → LiteSpeed Cache → Image Optimization → Image Optimization Settings → "Next‑Gen Image Format", use Image Optimization Summary → Optimization Tools → "Soft Reset Optimization Counter" after changes, and trigger processing with Auto Request Cron or the "Send Optimization Request" button. Be careful with Vary and Client Hints: list only the hints you actually use, prefer stable hints (Sec-CH-Width, Sec-CH-Viewport-Width, Sec-CH-ECT), and check your CDN’s requirements for keying on Accept or hints.
If you host on cPanel in Southeast Asia, Gocelerus is cPanel web hosting for Southeast Asia, serving Indonesia and Cambodia first.
Sources
- Image Optimization | Screen-by-Screen | LSCache for WordPress | LiteSpeed Documentation
- AVIF Support in LiteSpeed Plugin v7 ⋆ LiteSpeed Blog
- v7.8-a8: * Media Added extension check for WebP/AVIF replacement efficiency - only processes jpg/jpeg/png/gif, skips svg/ico/bmp etc. · 2b05e07 · litespeedtech/lscache_wp
- HTTP Client hints - HTTP | MDN
- RFC 8942: HTTP Client Hints
- Adapting to Users with Client Hints | Articles | web.dev
Manage your cPanel servers from one dashboard
Connect your WHM to Gocelerus and manage PHP, SSL, and WordPress across all your cPanel accounts from one place.