Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Don't send webp to CriOS when there is no accept:image/webp #1256

Closed
jmarantz opened this issue Jan 28, 2016 · 6 comments
Closed

Don't send webp to CriOS when there is no accept:image/webp #1256

jmarantz opened this issue Jan 28, 2016 · 6 comments
Assignees

Comments

@jmarantz
Copy link
Contributor

The latest Chrome on iOS, based on WKWebView, cannot render webp images, but mod_pagespeed sends them.

See http://blog.chromium.org/2016/01/a-faster-more-stable-chrome-on-ios.html

I confirmed that this browser also does not send accept:image/webp. If, in the future, webp is re-enabled in CriOS, it will likely send accept:image/webp again.

This is a workaround:

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

@jmarantz
Copy link
Contributor Author

Note: a similar issue was found in #969

@jmarantz jmarantz assigned jmarantz and unassigned huibaolin Jan 28, 2016
@jeffkaufman
Copy link
Contributor

At this point maybe we should switch to a simple "send webp if and only if we get accept:webp"?

@jmarantz
Copy link
Contributor Author

I agree with that, but that's a larger change (assuming we still want to send webp to Android 4.0) and want to do that in a follow-up.

@huibaolin
Copy link
Contributor

Android browser supports WebP since 4.0 but doesn't have WebP header. It
still has ~11% market share totally in mobile and tablet [1]. It's not
clear what is the portion of 4.0+ in this 11%, however most likely it's not
trivial.

[1]
https://www.netmarketshare.com/browser-market-share.aspx?qprid=2&qpcustomd=1

On Thu, Jan 28, 2016 at 10:41 AM, Joshua Marantz notifications@github.com
wrote:

I agree with that, but that's a larger change (assuming we still want to
send webp to Android 4.0) and want to do that in a follow-up.


Reply to this email directly or view it on GitHub
#1256 (comment)
.

@jmarantz
Copy link
Contributor Author

It turns out we need to separately disable webp-lossless and webp-animated, so the full workaround is:

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

@jmarantz
Copy link
Contributor Author

More detailed workaround information for nginx and apache. None of this will be needed once we have 23947d0 in a release.

Apache & mod_pagespeed 1.10:
# Temporary workaround for
# #1256
SetEnvIf User-Agent CriOS mps_disable_webp
RequestHeader set ModPagespeedFilters -convert_jpeg_to_webp,-convert_to_webp_lossless,-convert_to_webp_animated env=mps_disable_webp

Nginx & ngx_pagespeed 1.10:
http {
pagespeed ProcessScriptVariables on;
server {
set $disable_filters "";
if ($http_user_agent ~ CriOS) {
set $disable_filters "convert_jpeg_to_webp,convert_to_webp_lossless,convert_to_webp_animated";
}
pagespeed DisableFilters "$disable_filters";
}
}

In 1.9, there is no convert_to_webp_animated filter, and the nginx variable support is not present in PageSpeed so you have to completely disable webp until we get you a patch.

Apache & mod_pagespeed 1.9:
# Temporary workaround for
# #1256
SetEnvIf User-Agent CriOS mps_disable_webp
RequestHeader set ModPagespeedFilters -convert_jpeg_to_webp,-convert_to_webp_lossless env=mps_disable_webp

Nginx & ngx_pagespeed 1.9:
http {
pagespeed DisableFilters "convert_jpeg_to_webp,convert_to_webp_lossless";
}

jeffkaufman pushed a commit that referenced this issue Jan 29, 2016
jeffkaufman pushed a commit that referenced this issue Jan 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants