Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image/webp header not recognized by page speed insights #14833

Open
2 tasks done
RealMutant opened this issue Feb 27, 2023 · 3 comments
Open
2 tasks done

image/webp header not recognized by page speed insights #14833

RealMutant opened this issue Feb 27, 2023 · 3 comments
Assignees
Labels

Comments

@RealMutant
Copy link

RealMutant commented Feb 27, 2023

FAQ

URL

https://theaegisalliance.com/2023/02/25/michigan-man-wrongly-convicted-freed-after-21-years-in-prison-when-serial-killer-is-linked-to-murders/

What happened?

​This is from a support ticket with LiteSpeed Cache, a caching plugin for WordPress. Page Speed Insights accepts the image header */* but not image/webp. It's causing PSI to not recognize the webp images but instead view them as jpg. The image extensions are jpg.webp

This wasn't an issue until sometime last year, and may have to do with when PSI had a revamp where it displays more webpage data aspects. The webpage I've included is just one example, but this affects the featured image of posts on the entire website. PSI may recognize the image/webp format sometimes, periodically, or when first testing a link, but most of the time it doesn't.

the PSI is using following request header

​02/26/23 15:43:38.688 [66.249.93.133:41396 1 XWc] User Agent: Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Mobile Safari/537.36 Chrome-Lighthouse
02/26/23 15:43:38.688 [66.249.93.133:41396 1 XWc] Accept: */*​

from the plugin's code, we added

​RewriteCond %{HTTP_ACCEPT} "image/webp";​

​as condition check , to check if browser supports webp or not
but you can see the Google only sends the request with Accept: */* , it does not explicity indicate it accepts image/webp format , so webp replacement did not take effect
while on any of real browser , like this

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7

where it explicity included image/webp in its header , so plugin proceeds with webp file

What did you expect?

I was expecting PSI to recognize the webp images as it did before the revamp.

What have you tried?

I've tried removing functions.php code for faster LCP load times. I've also tried different functions.php code for faster LCP load times. Neither way made a difference for recognizing webp images, so the issue is with PSI.

How were you running Lighthouse?

PageSpeed Insights

Lighthouse Version

10.0.1

Chrome Version

110.0.5481.177

Node Version

No response

OS

Windows

Relevant log output

N/A
@RealMutant
Copy link
Author

My apologies for the confusion, this issue may be with the LiteSpeed Cache plugin that hasn't been updated to include that Internet Explorer is now defunct. A user in the Google Developer community made this point, and it's the recommended answer I chose in my post,

"I would add that the plugin's logic is perhaps wrong here. */* is the client saying it will accept any mimetype, so strictly speaking, it shouldn't have to explicitly look for image/webp

The reasons browsers send them really is more about using the quality values, the q part, to denote the priority they want the content in, so

text/html,application/xhtml+xml,application/xml;q=0.9 = 0.9, the highest priority for these types

image/webp,image/apng,*/*;q=0.8 images and everything else, a little lower (the inclusion is perhaps more legacy for servers that don't know webp is specifically an image.)

I'd say with the demise of IE 11, realistically nearly every visit is going to be from a browser that supports webp, but I guess a plugin for a webserver might not be able to cut off support?

FYI, googlebot also crawls with the accept header of */*"

@adamraine
Copy link
Member

adamraine commented Mar 7, 2023

I see, the PSI request header is different from what a normal browser would send. When I looked at the PSI request headers, the header for Accept was missing so maybe Chrome is using a different default in each scenario?

@adamraine adamraine added needs-investigation PSI/LR PageSpeed Insights and Lightrider and removed needs-priority labels Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 participants
@connorjclark @adamraine @devtools-bot @RealMutant and others