Workaround for WebP bug in Chrome v36 on iOS

84 views
Skip to first unread message

Jeff Kaufman

unread,
Aug 15, 2014, 10:01:50 AM8/15/14
to ngx-pagesp...@googlegroups.com, ngx-pagespe...@googlegroups.com
Chrome v36 on iOS has a regression where it will no longer display
inlined WebP images such as those generated by PageSpeed. This
regression has been fixed in the Chrome source and we're preparing an
update to PageSpeed to work around this bug. However, in the meantime
sites should apply the following workaround if they don't want to risk
breaking images for Chrome on iOS:

Add one of the two snippets below to your nginx configuration:

* Recommended: leave inlining enabled, but disable webp:

# Remove after 2014-10-15, when Chrome v36 becomes uncommon.
pagespeed DisableFilters convert_jpeg_to_webp;

* Less bandwidth: leave webp enabled, but disable image inlining:

# Remove after 2014-10-15, when Chrome v36 becomes uncommon.
pagespeed DisableFilters inline_images;

These affect all browsers; in a default install we can't apply the
workaround only to the affected browser. Alternatively, if you have
the (non-standard) headers_more module installed, it should be
possible to add an input header "PageSpeedFilters:
-convert_jpeg_to_webp" for requests with User Agents matching the
regex "CriOS/36[.]". For full documentation on the headers_more
module, see http://wiki.nginx.org/HttpHeadersMoreModule

Note that the Chrome bug only affects inlined WebP images on iOS;
external WebP images, images inlined for other platforms, and images
in other formats still work correctly. If you would like to track the
progress of the Chrome bug, you can follow it on the Chromium bug
tracker: https://crbug.com/402514

For updates, follow our bug tracker:
https://code.google.com/p/modpagespeed/issues/detail?id=969

Jeff Kaufman
PageSpeed Team

Hans van Eijsden

unread,
Aug 15, 2014, 8:40:09 PM8/15/14
to ngx-pagesp...@googlegroups.com, ngx-pagespe...@googlegroups.com
Jeff, it took me several whole nights to investigate my setup and I became frustrated as I couldn't solve the problem: I really thought it was something wrong in my configs and nginx-chains.
I'm very happy (or, unhappy...) with your announcement, finally knowing the cause of the iOS Chrome problems (as many visitors and clients were complaining already). Thanks for posting!

Op vrijdag 15 augustus 2014 16:01:50 UTC+2 schreef Jeff Kaufman:

Joshua Marantz

unread,
Jan 28, 2016, 9:44:39 AM1/28/16
to ngx-pagespeed-discuss, ngx-pagespe...@googlegroups.com
Update for January 2016: the new Chrome on iOS does not accept webp, but I believe ngx_pagespeed will send it.  I know that mod_pagespeed will.  For mod_pagespeed there is a targeted workaround using the Apache SetEnvIf directive:

SetEnvIf User-Agent CriOS mps_disable_webp
RequestHeader set ModPagespeedFilters -convert_jpeg_to_webp env=mps_disable_webp

However, I am not aware of an equivalent nginx directive.  Until we fix this, please disable conversion to webp:
  pagespeed DisableFilters convert_jpeg_to_webp; 
A fix is being reviewed now.

Jeff Kaufman

unread,
Jan 28, 2016, 10:52:54 AM1/28/16
to ngx-pagesp...@googlegroups.com, ngx-pagespe...@googlegroups.com
With ngx_pagespeed 1.10 (but not 1.9) it's possible to disable webp
just for chrome on ios:

http {
pagespeed ProcessScriptVariables on;
server {
set $disable_filters "";
if ($http_user_agent ~ CriOS) {
set $disable_filters "convert_jpeg_to_webp";
}
pagespeed DisableFilters "$disable_filters";
}
}

See https://developers.google.com/speed/pagespeed/module/system#nginx_script_variables

It's possible that there's a workaround for 1.9 involving request
headers, but I'm not sure yet.

(We're still working on getting out a new release as quickly as we can.)
> --
> 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 ngx-pagespeed-di...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ngx-pagespeed-discuss.
>
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages