• Resolved arkt1234

    (@arkt1234)


    Today i noticed, that Webp is not served anymore. After long trying i found out, that changes in the standard preset accept header in firefox are the reason.

    New: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

    Old: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8

    It does also affect the pagespeed metrics, where webp is also not served anymore. But i can still see webp on the edge browser. I cannot find much about it in the internet (Only: https://www.camp-firefox.de/forum/thema/138550-falscher-accept-header/ ). What do i need to change to get webp served on pagespeed and firefox again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter arkt1234

    (@arkt1234)

    I found a breadcrumb more about Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1917177

    Somehow annoying, that the information about this is scattered so sparsely. I miss the time, when google actually was able to find such things fast. But back to topic. Can i do something to get webp served again or do i have to replace the original images with webp to get this done?

    Plugin Support wpmansour

    (@wpmansour)

    Thanks for raising this issue! We’ve looked into the recent changes in Firefox’s Accept header, and it seems Mozilla has updated the default to better adhere to web standards. This change impacts how image formats like WebP are handled, as they are no longer explicitly listed in the header. It’s a standardization effort that aligns with Safari’s behavior and resolves compatibility issues seen in the past.

    Here’s what you can do to address this:

    1. Check WP-Optimize’s WebP Settings: Ensure that WebP is enabled in WP Admin > WP-Optimize > Images > Image Compression. This allows WP-Optimize to handle WebP conversion and serving.
    2. Server-Side Content Negotiation: If you’re using Apache, you can add this to your .htaccess file to ensure WebP is served where supported, even with the updated header:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{REQUEST_FILENAME} (.*)\.(jpe?g|png)$
    RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
    RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1,L]
    </IfModule>
    <IfModule mod_headers.c>
    Header append Vary Accept env=REDIRECT_accept
    </IfModule>

    This ensures WebP is served when possible, regardless of the Accept header specifics.

      This change also impacts tools like PageSpeed Insights, which may misinterpret the missing WebP delivery, despite browser support. Using these adjustments should help you maintain performance and compatibility.

      Let us know if you need further clarification or assistance! Thanks!

      Thread Starter arkt1234

      (@arkt1234)

      Thanks for your reply and support. I got Webp activated and as i told it works fine on Edge. I tried switching it off and on and resetting webp serving method and switching off all plugins and again and every step with deleting cache.

      The .htaccess does not work on my wordpress. I assume its because i can only add it in my own wordpress directory. The server is indeed apache but my website is hosted by ionos as “standard shared webhosting”.

      Plugin Support wpmansour

      (@wpmansour)

      It seems like the issue is with your hosting setup. Since WebP works on Edge, the issue likely lies in how the server handles Firefox’s new Accept header.

      To fix this, try using a CDN like Cloudflare to serve WebP automatically, bypassing the server limitations. If that’s not an option, reach out to hosting provider support to confirm if WebP negotiation is supported.

      Thread Starter arkt1234

      (@arkt1234)

      I found the root cause for this problem. My server does somehow fail the detection if there is a webp file present. So i decided to choose the hard way for my .htaccess and it finally works! Now webp gets served without asking questions anymore!

      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} -f
      RewriteRule ^(.*)\.(jpe?g|png)$ $1.$2.webp [T=image/webp,L]
      </IfModule>
      Thread Starter arkt1234

      (@arkt1234)

      An improvement. I found out, that the rewrite condition asking for a existing webp works not everywhere with the same synthax. The row is problematic on some servers.

      RewriteCond %{DOCUMENT_ROOT}/$1.webp -f

      This one works then:

      RewriteCond %{REQUEST_FILENAME}.webp -f

      God damn is it really so hard for server and web and browser developers to make some unified standards? The more i dive into the webp problem, the more problems from different directions show up. But whatever, this code works now. It actually checks first if there is a webp file to serve before serving it.

      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} -f
      RewriteCond %{REQUEST_FILENAME}.webp -f
      RewriteRule ^(.*)\.(jpe?g|png)$ $1.$2.webp [T=image/webp,L]
      </IfModule>
      • This reply was modified 2 hours, 47 minutes ago by arkt1234.
    Viewing 6 replies - 1 through 6 (of 6 total)
    • You must be logged in to reply to this topic.