ImagePreserveURLs not working

Skip to first unread message

rama sesha rao Kankatala

Nov 3, 2022, 6:25:40 AM11/3/22
to ngx-pagespeed-discuss
Hi Team,

Need your help in preserving image name.


Converting png, jpg, jpeg to webp without name change.

We don't want .pagespeed or random string to image name.
Original Image name: orange.jpg
Expected Image name(webp format): orange.jpg or orange.jpg.webp or orange.webp 
Actual Image name:

Below is my config

server {
 pagespeed on;
pagespeed RewriteLevel PassThrough;
pagespeed EnableCachePurge on;
pagespeed PurgeMethod PURGE;
pagespeed RewriteLevel OptimizeForBandwidth;
 pagespeed EnableFilters convert_png_to_jpeg;
  pagespeed EnableFilters convert_jpeg_to_webp;
pagespeed ImagePreserveURLs true;
pagespeed DisableFilters inline_images,combine_css,combine_javascript,extend_cache_scripts,extend_cache_css,flatten_css_imports,resize_images;
pagespeed ForbidAllDisabledFilters true;
    pagespeed FileCachePath "/var/cache/ngx_pagespeed_678/";
pagespeed Statistics on;
pagespeed StatisticsLogging on;
pagespeed LogDir /var/log/pagespeed;
pagespeed AdminPath /pagespeed_admin;
pagespeed FetchHttps enable;
location ~ ^/pagespeed_admin {

        listen 80 default_server;
        listen [::]:80 default_server;
 root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;


Nov 13, 2022, 8:32:51 AM11/13/22
to ngx-pagespeed-discuss
>> Converting png, jpg, jpeg to webp without name change.
That not feasible, if you convert to webp format from jpg,png, the name must include some pagespeed stuff.
If you preserve url some optimizations are done (like resize the image or change the image quality), but not image conversions.

Joshua Marantz

Nov 13, 2022, 9:41:34 AM11/13/22
I think actually OptimizeForBandwidth includes converting jpeg to webp. See the table at the bottom of and the row for convert_jpeg_to_webp.

The ".jpeg" extension is not actually the critical determinant -- it's the content-type returned in response headers. Please give OptimizeForBandwidth level a try!

You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages