filter · Image filters
Extend cache for images (extend_cache_images)
- Category:
- Image
- CoreFilters:
- Yes
- OptimizeForBandwidth:
- No
- Risk:
- Generally safe
Core filter, one of the three members of extend_cache. Rewrites image URLs to content-hashed .pagespeed.ce. URLs served with a one-year Cache-Control max-age, so browsers keep images for a year while a changed image gets a new URL. Use it when the origin cannot set long cache lifetimes itself; under CoreFilters it is already on through extend_cache, and rewrite_images produces content-hashed URLs of its own for every image it rewrites.
How it works
Disabling it leaves extend_cache_css and extend_cache_scripts on. Live demo: extend_cache.
When to use it
- In CoreFilters, the default RewriteLevel: it runs unless you disable it.
- Also switched on by
extend_cache. - Risk rating on these docs: Generally safe.
Risks
The
Image filters
page lists no specific risks for this filter.
If a page misbehaves with it, DisableFilters extend_cache_images turns it off for
the scope you set it in.
Configuration
Enable it in the module configuration, at server, virtual-host or location scope:
Apache
ModPagespeedEnableFilters extend_cache_imagesnginx
pagespeed EnableFilters extend_cache_images;IIS (pagespeed.config)
pagespeed EnableFilters extend_cache_imagesIt is on by default under CoreFilters; to turn it off:
ModPagespeedDisableFilters extend_cache_images # Apache
pagespeed DisableFilters extend_cache_images; # nginx
pagespeed DisableFilters extend_cache_images # IISOn the worker
The worker runs its own pipeline, configured by flags. Its equivalent of this filter
is the
cache extension
transform. Always-on under pagespeed on;.
Scoping, ForbidFilters and the thresholds filters read:
Choosing filters
.
Frequently asked questions
- What does the extend_cache_images filter do?
- Core filter, one of the three members of
extend_cache. Rewrites image URLs to content-hashed.pagespeed.ce.URLs served with a one-yearCache-Controlmax-age, so browsers keep images for a year while a changed image gets a new URL. Use it when the origin cannot set long cache lifetimes itself; under CoreFilters it is already on throughextend_cache, andrewrite_imagesproduces content-hashed URLs of its own for every image it rewrites. - Is extend_cache_images enabled by default?
- Yes.
extend_cache_imagesis in CoreFilters, the default RewriteLevel, so it runs unless you turn it off withDisableFilters. - How do I turn off extend_cache_images?
- Add
ModPagespeedDisableFilters extend_cache_imageson Apache orpagespeed DisableFilters extend_cache_images;on nginx. On IIS, addpagespeed DisableFilters extend_cache_imagesto pagespeed.config.
Related filters
- convert_gif_to_png — Convert GIF to PNG
- convert_jpeg_to_avif — Convert JPEG to AVIF
- convert_jpeg_to_progressive — Progressive JPEG
- convert_jpeg_to_webp — Convert JPEG to WebP
- convert_png_to_jpeg — Convert PNG to JPEG
- convert_to_avif_animated — Animated AVIF
- convert_to_avif_lossless — Lossless AVIF
- convert_to_webp_animated — Animated WebP
This page is drawn from the extend_cache_images entry on Image filters. Every filter in one table: PageSpeed filters.