Discover Centmin Mod today
Register Now

PageSpeed How to disable webP

Discussion in 'Web Development & Web Performance' started by Jon Snow, Sep 17, 2020.

  1. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    I haven't done any of this - Nginx Serving WebP Images Conditionally Demo

    The webp include isn't in the nginx vhost context.

    But images are webp. Some are broken from time to time, so I want to continue using Nginx PageSpeed but disable webP support as I don't need it.

    How can this be done?

     
  2. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    I also don't use Cloudflare's pro plan that has the option for webp support.

    Images get the webp extension.
     
  3. eva2000

    eva2000 Administrator Staff Member

    49,581
    11,377
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,680
    Local Time:
    6:16 PM
    Nginx 1.21.x
    MariaDB 10.x
  4. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
  5. eva2000

    eva2000 Administrator Staff Member

    49,581
    11,377
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,680
    Local Time:
    6:16 PM
    Nginx 1.21.x
    MariaDB 10.x
    both links point to same post for me. Did you change the option of how many posts per thread page you want to view ?

    link to an example page with webP images ?
     
  6. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    It points to different posts for me. I wasn't even aware users could change that setting, but that's still a huge gap between pages - page 9 and page 17. Maybe it depends on the browser.
    I'll PM the link to the site.
     
  7. eva2000

    eva2000 Administrator Staff Member

    49,581
    11,377
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,680
    Local Time:
    6:16 PM
    Nginx 1.21.x
    MariaDB 10.x
    Generally browser shouldn't - strange indeed
    add ngx_pagespeed debug query string ?PageSpeedFilters=+debug to inspect your source code of your page will show you which ngx_pagespeed filters are enabled

    for your site webP conversion filter is still enabled for
    Code (Text):
    jw    Convert Jpeg To Webp

    Code (Text):
    <!--
    mod_pagespeed on
    Filters:
    ah    Add Head
    cc    Combine Css
    jc    Combine Javascript
    gp    Convert Gif to Png
    jp    Convert Jpeg to Progressive
    jw    Convert Jpeg To Webp
    mc    Convert Meta Tags
    pj    Convert Png to Jpeg
    ws    When converting images to WebP, prefer lossless conversions
    db    Debug
    ec    Cache Extend Css
    ei    Cache Extend Images
    es    Cache Extend Scripts
    fc    Fallback Rewrite Css
    if    Flatten CSS Imports
    hw    Flushes html
    ci    Inline Css
    ii    Inline Images
    il    Inline @import to Link
    ji    Inline Javascript
    js    Jpeg Subsampling
    rj    Recompress Jpeg
    rp    Recompress Png
    rw    Recompress Webp
    ri    Resize Images
    cf    Rewrite Css
    jm    Rewrite External Javascript
    jj    Rewrite Inline Javascript
    cu    Rewrite Style Attributes With Url
    cp    Strip Image Color Profiles
    md    Strip Image Meta Data
    
    Options:
    AvoidRenamingIntrospectiveJavascript (aris) True
    EnableRewriting (e) 1
    FileCacheInodeLimit (afcl) 500000
    RewriteLevel (l) Core Filters
    
    #NumFlushes            0
    #EndDocument after     4706us
    #Total Parse duration  3929us
    #Total Render duration 10139us
    #Total Idle duration   777us
    No critical images detected.
    The following filters were disabled for this request:
        SupportNoscript
    -->
     
  8. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    Is there anything that would enable it? I'm not sure why it's ON.

    This is the pagespeed config:

    Code (Text):
    pagespeed on;
    
    #######################################################
    # Purge nginx pagespeed cache
    # https://developers.google.com/speed/pagespeed/module/system#flush_cache
    #######################################################
    pagespeed EnableCachePurge on;
    pagespeed PurgeMethod PURGE;
    
    #######################################################
    # File cache settings 
    ######################################
    # needs to exist and be writable by nginx
    
    # pagespeed FileCacheSizeKb          102400;
    # pagespeed FileCacheCleanIntervalMs 3600000;
    # pagespeed FileCacheInodeLimit      500000;
    
    #######################################################
    # By default, ngx_pagespeed adds an X-PageSpeed header with a value of the version of 
    # ngx_pagespeed being used. This directive lets you specify the value to use instead:
    # pagespeed XHeaderValue "ngx_pagespeed";
    
    #######################################################
    # let's speed up PageSpeed by storing it in the super duper fast memcached
    # Ensure Memcached server installed http://centminmod.com/memcached.html
    # default install for centmin mod is on port 11211, so localhost:11211 is correct
    # uncomment - remove hash # in front of below 2 lines to enable
    # timeout set at 100 milliseconds
    #  pagespeed MemcachedThreads 1;
    #  pagespeed MemcachedServers "localhost:11211";
    #  pagespeed MemcachedTimeoutUs 100000;
    
    #######################################################
    ## 1.11.33.0 beta save-data
    ######################################
    # https://developers.google.com/speed/pagespeed/module/filter-image-optimize#image-quality
    
    # https://developers.google.com/speed/pagespeed/module/reference-image-optimize#JpegQualityForSaveData
    pagespeed JpegQualityForSaveData 50;
    
    # https://developers.google.com/speed/pagespeed/module/reference-image-optimize#WebpQualityForSaveData
    pagespeed WebpQualityForSaveData 50;
    
    #######################################################
    ## 1.7.30.1 beta defaults
    ######################################
    pagespeed PreserveUrlRelativity on;
    pagespeed MaxCombinedCssBytes -1;
    pagespeed ImageResolutionLimitBytes 16777216;
    # pagespeed EnableFilters inline_google_font_css;
    
    #######################################################
    ## 1.6.29.3 beta defaults
    ######################################
    pagespeed AvoidRenamingIntrospectiveJavascript on;
    pagespeed ImageInlineMaxBytes 3072;
    pagespeed CssImageInlineMaxBytes 0;
    pagespeed MaxInlinedPreviewImagesIndex -1;
    pagespeed MinImageSizeLowResolutionBytes 3072;
    
    #######################################################
    ## ngx_pagespeed filters settings below ##
    ######################################
    
      # show half the users an optimized site, half the regular site
      # change UA-XXXXXXXXXX-1 to your GA unique id
      # uncomment - remove hash # in front of below 5 lines to enable
    #  pagespeed RunExperiment on;
    #  pagespeed AnalyticsID UA-XXXXXXXXXX-1;
    #  pagespeed ExperimentVariable 1;
    #  pagespeed ExperimentSpec "id=1;percent=50;level=CoreFilters;enabled=collapse_whitespace,remove_comments;";
    #  pagespeed ExperimentSpec "id=2;percent=50";
    
      # Filter settings
      # filters outlined at http://ngxpagespeed.com/ngx_pagespeed_example/
      pagespeed RewriteLevel CoreFilters;
      pagespeed EnableFilters collapse_whitespace,remove_comments;
    
      # make_google_analytics_async
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-make-google-analytics-async
    #  pagespeed EnableFilters make_google_analytics_async;
    
      # make_show_ads_async
      # https://developers.google.com/speed/pagespeed/module/filter-make-show-ads-async
    #  pagespeed EnableFilters make_show_ads_async;
    
      # responsive_images, responsive_images_zoom
      # https://developers.google.com/speed/pagespeed/module/filter-image-responsive
    #  pagespeed EnableFilters responsive_images;
    #  pagespeed EnableFilters responsive_images_zoom;
    
      # convert_to_webp_animated
      # https://developers.google.com/speed/pagespeed/module/filter-image-optimize#convert_to_webp_animated
    #  pagespeed EnableFilters convert_to_webp_animated;
    
      # inline_google_font_css
      # https://developers.google.com/speed/pagespeed/module/filter-css-inline-google-fonts
      pagespeed EnableFilters inline_google_font_css;
      # require FetchHttps if using https site
    #   pagespeed FetchHttps enable;
    
      # inline_css
      # https://developers.google.com/speed/pagespeed/module/filter-css-inline
    #   pagespeed EnableFilters inline_css;
    #   pagespeed CssInlineMaxBytes 2048;
    
      # prioritize_critical_css
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-prioritize-critical-css
    #   pagespeed EnableFilters prioritize_critical_css;
    
      # move_css_to_head
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-css-to-head
      pagespeed EnableFilters move_css_to_head;
    
      # move_css_above_scripts
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-css-above-scripts
    #  pagespeed EnableFilters move_css_above_scripts;
    
      # combine_css 
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-css-combine
    #  pagespeed EnableFilters combine_css;
    
       # Uncomment this if you want to prevent mod_pagespeed from combining files
       # (e.g. CSS files) across paths
       #
    #  pagespeed CombineAcrossPaths off;
    
      # combine_javascript
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-js-combine
    #  pagespeed EnableFilters combine_javascript;
    #  pagespeed MaxCombinedJsBytes 122900;
    
      # extend_cache
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-cache-extend
    #  pagespeed EnableFilters extend_cache;
    
      # rewrite_css
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-css-rewrite
    #  pagespeed EnableFilters rewrite_css;
    
      # rewrite_javascript
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-js-minify
    #  pagespeed EnableFilters rewrite_javascript;
    
      # inline_preview_images
      # https://developers.google.com/speed/pagespeed/module/filter-inline-preview-images
      pagespeed EnableFilters inline_preview_images;
    
      # lazyload_images
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-lazyload-images
    #  pagespeed EnableFilters lazyload_images;
    
      # rewrite_images
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-image-optimize
    #  pagespeed EnableFilters rewrite_images;
       pagespeed DisableFilters rewrite_images;
       pagespeed DisableFilters recompress_images;
       pagespeed DisableFilters convert_png_to_jpeg;
       pagespeed DisableFilters extend_cache_images;
    #  pagespeed EnableFilters convert_png_to_jpeg;
    #  pagespeed EnableFilters convert_jpeg_to_webp;
    #  pagespeed EnableFilters convert_to_webp_lossless;
    
      # sprite_images
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-image-sprite
    # pagespeed EnableFilters rewrite_css,sprite_images;
    
      # insert_dns_prefetch
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-insert-dns-prefetch
    #  pagespeed EnableFilters insert_dns_prefetch;
    
      # InPlaceResourceOptimization
      # https://developers.google.com/speed/pagespeed/module/system#ipro
      # Enabled by default as of 1.9.32.1
      pagespeed InPlaceResourceOptimization off;
    
    #######################################################
    
     
  9. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    This has always been commented out btw:
    Code (Text):
    #  pagespeed EnableFilters convert_jpeg_to_webp;
    #  pagespeed EnableFilters convert_to_webp_lossless;

    I've never turned it ON.

    One day I noticed broken images and figured out webp was supported, that's why I'm trying to turn it OFF.
     
  10. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    /usr/local/nginx/conf/

    Also has many pagespeed configs but they're all with numbers (seems like backups):

    pagespeed.png
     
  11. eva2000

    eva2000 Administrator Staff Member

    49,581
    11,377
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,680
    Local Time:
    6:16 PM
    Nginx 1.21.x
    MariaDB 10.x
    instead of
    Code (Text):
    #  pagespeed EnableFilters convert_jpeg_to_webp;
    #  pagespeed EnableFilters convert_to_webp_lossless;
    

    try disable filter
    Code (Text):
      pagespeed DisableFilters convert_jpeg_to_webp;
      pagespeed DisableFilters convert_to_webp_lossless;
    
     
  12. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    Didn't seem to work :( I also restarted nginx.
     
  13. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    Rebuilding nginx fixes this but this just popped out of nowhere again today.
     
  14. eva2000

    eva2000 Administrator Staff Member

    49,581
    11,377
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,680
    Local Time:
    6:16 PM
    Nginx 1.21.x
    MariaDB 10.x
    what do you mean popped out of no where ?
     
  15. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    The last time I upgraded nginx, files weren't webp. I was already on the latest version of nginx and yesterday I noticed a broken avatar. I checked the extension and it was webp. So the issue appeared again overnight.

    I had to rebuild nginx again to fix it. But webp enables itself without even doing anything.
     
  16. eva2000

    eva2000 Administrator Staff Member

    49,581
    11,377
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,680
    Local Time:
    6:16 PM
    Nginx 1.21.x
    MariaDB 10.x
    You using Cloudflare free plan? As that doesn't support HTTP Vary header which allows you to conditionally server webP images from origin Nginx server Cloudflare CDN Cache To Support HTTP Vary Header so ngx_pagespeed webP images may not work. What happens if if a non-supported webP browser visits your site behind Cloudflare free plan, Cloudflare CDN cache's the broken webP image and without HTTP Vary header support what happens if next visit from a webP supported browser will get served the CDN cached broken webP image.

    • With Cloudflare free plan, you can't do webP conversions on origin Nginx server
    • With Cloudflaree pro and higher plans, you do not need to do webP conversions on origin Nginx server as Cloudflare pro and higher's Polish does on the fly webP conversions.
     
  17. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    I don't use Cloudflare for this site.

    I think the reason why rebuilding nginx fixed it is because I had uncommented the pagespeed configs from the vhost file. My friend who I help manage the server for said if I can't figure it out, best to disable it, so that's probably what I ended up doing. This is my config file:

    Code (Text):
    server {
       
       server_name domain.com www.domain.com;
       return 302 https://domain.com$request_uri;
       include /usr/local/nginx/conf/staticfiles.conf;
     }
    
    server {
      listen 443 ssl http2;
      server_name domain.com www.domain.com;
    
            if ($host = 'www.domain.com' ) {
            return 301 https://domain.com$request_uri;
            }
    
      include /usr/local/nginx/conf/ssl/domain.com/domain.com.crt.key.conf;
      include /usr/local/nginx/conf/ssl_include.conf;
    
     
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      http2_max_requests 50000;
      # mozilla recommended
      ssl_ciphers TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
    
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      add_header X-Xss-Protection "1; mode=block" always;
      add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
      #add_header Feature-Policy "accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'";
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
     
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 1.1.1.1 1.0.0.1 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/domain.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf;
      root /home/nginx/domains/domain.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      location / {
      try_files $uri $uri/ /index.php?$uri&$args;
      index index.php index.html;
    
      include /usr/local/nginx/conf/blockbots.conf;
      include /usr/local/nginx/conf/503include-only.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Wordpress Permalinks example
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      }
    
    
    
      location /install/data/ {
      internal;
      allow 127.0.0.1;
        deny all;
    }
    location /install/templates/ {
      internal;
      allow 127.0.0.1;
        deny all;
    }
    location /internal_data/ {
      internal;
        allow 127.0.0.1;
        deny all;
    }
    location /library/ {
      internal;
      allow 127.0.0.1;
        deny all;
    }
    
    
    
    
    
    
    
    location /test/ {
      try_files $uri $uri/ /test/index.php?$uri&$args;
      index index.php index.html;
    }
    
    location /test/install/ {
        auth_basic "Private";
        include /usr/local/nginx/conf/php.conf;
        allow 127.0.0.1;
        allow IP-removed;
        deny all;
            } 
    
    location /test/install/data/ {
      internal;
      allow 127.0.0.1;
        deny all;
    }
    location /test/install/templates/ {
      internal;
      allow 127.0.0.1;
        deny all;
    }
    location /test/internal_data/ {
      internal;
        allow 127.0.0.1;
        deny all;
    }
    location /test/library/ {
      internal;
      allow 127.0.0.1;
        deny all;
    }
    
    
    
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    
     
  18. eva2000

    eva2000 Administrator Staff Member

    49,581
    11,377
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,680
    Local Time:
    6:16 PM
    Nginx 1.21.x
    MariaDB 10.x
    so you forgot to uncomment the nginx pagespeed include files was the issue ?
     
  19. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    It was already uncommented out but I knew I had it enabled before. I must have done that a while back and forgot to restart nginx for the effects to take place.

    I'll update this thread if webp comes back again. I know for certain the pagespeed configs are out from the vhost config now.
     
  20. Jon Snow

    Jon Snow Active Member

    680
    130
    43
    Jun 30, 2017
    Ratings:
    +192
    Local Time:
    4:16 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    @eva2000 Okay, so I can confirm it now. Haven't done a thing and I see .webp is back.