apache / incubator-pagespeed-ngx

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
4.37k stars 363 forks source link

Uncacheable content, preventing rewriting of image #1681

Open ws420 opened 4 years ago

ws420 commented 4 years ago

Hello,

We are having trouble with Pagespeed, the images are not rewriting to webp and the cache doesn't seem to be working. The debug mode is showing errors: Uncacheable content, preventing rewriting of...

Setup:

Temporarily disabling Cloudflare and Nginx proxy didn't help.

I tried to configure downstream cache to see if it helps but I am not sure where to put the directives from your guide under the "Nginx proxy_cache" section here: https://www.modpagespeed.com/doc/downstream-caching

Copying the directives in Plesk "additional nginx directives" returns an error saying not allowed.

Maybe we are supposed to put the directives in a .conf file but there are many of them so which one? Most of the files have this warning:

DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,

SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED

Apache directives (in Plesk)

ModPagespeed On

ModPagespeedDisableRewriteOnNoTransform off
ModPagespeedEnableFilters rewrite_css
ModPagespeedEnableFilters combine_css

ModPagespeedEnableFilters recompress_images
ModPagespeedEnableFilters convert_png_to_jpeg
ModPagespeedEnableFilters convert_jpeg_to_webp
#ModPagespeedEnableFilters convert_jpeg_to_progressive
ModPagespeedEnableFilters convert_to_webp_lossless
ModPagespeedEnableFilters recompress_webp
ModPagespeedEnableFilters lazyload_images

ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters make_google_analytics_async

ModPagespeedEnableFilters rewrite_javascript
# ModPagespeedEnableFilters combine_javascript
# ModPagespeedEnableFilters defer_javascript

ModPagespeedFetchHttps enable,allow_self_signed,allow_unknown_certificate_authority

AddOutputFilterByType DEFLATE text/plain text/html text/xml;
AddOutputFilterByType DEFLATE text/css text/javascript;
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml;
AddOutputFilterByType DEFLATE application/rss+xml;
AddOutputFilterByType DEFLATE application/javascript application/x-javascript

Plesk "Additional nginx directives"

pagespeed on;
pagespeed FileCachePath "/var/cache/nginx_weedstreet420/";
pagespeed RewriteLevel OptimizeForBandwidth;
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
    add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }

gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_disable "msie6";
gzip_types text/plain text/css text/javascript text/xml application/json application/javascript application/x-javascript application/xml application/xml+rss;

https://www.weedstreet420.com/?PageSpeedFilters=%20debug

Lofesa commented 4 years ago

Hi Seems you have this: user -> cloudflare -> pagespeed-> nginx -> pagespeed -> apache and, I think, you need user -> cloudflare -> pagespeed -> ngxinx -> apache OR user -> cloudflare -> nginx -> pagespeed -> apache I will say, pagespeed must be installed in nginx OR in apache, not in both. For debug purposes, cloudflare is noise, put it on bypass mode or activate the developer mode. Your sub-request don´t have cache-control hader and the main request have 2 cache-control header, but both are uncacheable. Pagespeed, to work, need that resources are public cacheable. If you look at the image, in the blue circles, you can view what I´m saying. The unplugged parameter disables pagespeed.

tempsnip

When you use a proxy, is the proxy that hit the webserver, not the user, so you need to send the user IP and user UA from the proxy to the webserver.

My advice is to work, at first place, ony with pagespeed->apache, and when you have all isues solved here, then add nginx, and when you solve issues here, then add cloudflare.

ws420 commented 4 years ago

Thanks for the reply

Cloudflare is now in dev mode and I have disabled nginx proxy & caching

Now the errors in the debug mode are different 4xx status code, preventing rewriting of ...

The cache-control header of the images is now "s-maxage=10" image

Lofesa commented 4 years ago

Hi The s-maxage is a transient header. The resource is not optimized yet, so must not be stored in any intermediate cache for more than 10 sec. I have trouble debuging your site, when I put https://www.weedstreet420.com/?PageSpeedFilters=+debug (note the + sign) the site enter in an infinite loop.

Can you try to set ModPagespeedSupportNoScriptEnabled false

In other hand, all the images are served with a cache-control: nostore, nocache . I don´t know if these header is set by your origin server or by cloudflare.... can you instruct cloudflare to respect origin headers? In developer mode clodflare is set to DYNAMIC, this mode don´t send the assets stored in their cache but do all the magic with header and other optimizations you set in cloudflare. The better way to eliminate cloudflare in the debug path is putting all in grey in the dns section. In this way, cloudflare do nothing and the request are served directly from the origin webserver. As you can see in the image no filters are enabled, and no debug messages are set in the html code, only the bottom stuff. When I try to enable any filter in the url, get and infinite loop, so can´t test it. (To enable a filter with the url https://www.weedstreet420.com/?PageSpeedFilters=+rewrite_images . The + sign enables it and the - sign disables)

tempsnip

EDIT: Clear the cloudflare cache.

ws420 commented 4 years ago

I also had the problem with the infinite loop but ModPagespeedSupportNoScriptEnabled fixed it. I also purged Cloudflare cache

Here's the settings in Cloudflare (dev mode) image

in Plesk image

Directives image

htaccess

Modpagespeed On

  ModPagespeedEnableFilters rewrite_css
  ModPagespeedEnableFilters combine_css

  ModPagespeedEnableFilters recompress_images
  ModPagespeedEnableFilters convert_png_to_jpeg
  ModPagespeedEnableFilters convert_jpeg_to_webp
  #ModPagespeedEnableFilters convert_jpeg_to_progressive
  ModPagespeedEnableFilters convert_to_webp_lossless
  ModPagespeedEnableFilters recompress_webp
  ModPagespeedEnableFilters lazyload_images

  ModPagespeedEnableFilters collapse_whitespace
  ModPagespeedEnableFilters remove_comments
  ModPagespeedEnableFilters extend_cache
  ModPagespeedEnableFilters make_google_analytics_async

  ModPagespeedEnableFilters rewrite_javascript
  # ModPagespeedEnableFilters combine_javascript
  # ModPagespeedEnableFilters defer_javascript

# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
# Wordfence WAF
<Files ".user.ini">
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
</IfModule>
</Files>

# END Wordfence WAF

<IfModule mod_expires.c>
  ExpiresActive On

  # Images
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"

  # Video
  ExpiresByType video/mp4 "access plus 1 year"
  ExpiresByType video/mpeg "access plus 1 year"

  # CSS, JavaScript
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/javascript "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"

  # Others
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 month"

  # Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
</IfModule>

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) wp/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
RewriteRule . index.php [L]

  RewriteRule ^/sw.js$ <location>

I think there's something wrong with the htaccess so I commented out this part: # Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"

Now the error is "4xx status code, preventing rewriting" and the website is broken because images and other resources are returning 404 errors At least I see some webp rewriting in the source code now, so we are making some progress!

Thanks for your help

Edit: I tried adding ModPagespeedFetchHttps enable but I get an Internal Server Error. I had to disable pagespeed temporarily for now because the entire website was broken due to 404s

Lofesa commented 4 years ago

Well... Where the plesk panel put these directives? in a vhost config file? If yes, you don´t need to set the pagespeed directives in the htacces again. If I remember, the config files in apache have sections, like VirtualHost, Directory, Location or Files. I don´t know how Plesk work, but I bet that it creates a file with 2 VirtualHost for http an https, and the default directives for Directory and so.... The pagespeed directives you put here are for the whole site, you no need to duplicate it in any htacces. Htacces are files to overwrite config setings in a directory (you can have a htacces file in each directory). Unless you need to enable (or disable) a diferent set of filters in that directory. This: # Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0" makes all resources uncacheable, so pagespeed can´t optimize it. You need to enable it, but with some like: Header set Cache-Control "max-age=86400, public" This make resources cacheable for 1 day, so pagespeed can optimize it and when optimized, it changes to 1 year.

I think nginx still working, as far I can see the header x-pagespeed that is set by nginx. If the working module of pagespeed is in apache server these header must be X-Mod-Pagespeed. Are you hitting the apache web server directly or you have configured cloudflare to bypass for your ip? I can´t see the changes you made in config, so I still getting the infinite loop.

tempsnip

Lofesa commented 4 years ago

Ah! your site is https, so you need to configure fechthttps or loadfromfile. By default, pagespeed tries to fecht resources by http, and maybe the 404 error´s you see is for don´t have the https enabled.

ModPagespeedFetchHttps enable

ModPagespeedSslCertDirectory directory

ModPagespeedSslCertFile file

If the server is a Debian-Ubuntu family only need to configure the directory, by default /etc/ssl/certs If is a RedHat-Centos family, need both directory and file, by default /etc/pki/tls/certs /etc/pki/tls/cert.pem

EDIT: Seems that cloudflare is enabled again. I see HIT in some resources. EDIT 2: You see the webp in content-type header, but file extension still in jpg or png = IPRO is working. IPRO is an on-the-fly optimizer, make some optimizations but don´t rewrite the url.

ws420 commented 4 years ago

Well... Where the plesk panel put these directives? in a vhost config file? If yes, you don´t need to set the pagespeed directives in the htacces again.

I added some directives in plesk panel and this file was updated: /var/www/vhosts/system/weedstreet420.com/conf/vhost_ssl.conf

This:

Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"

makes all resources uncacheable, so pagespeed can´t optimize it. You need to enable it, but with some like: Header set Cache-Control "max-age=86400, public" This make resources cacheable for 1 day, so pagespeed can optimize it and when optimized, it changes to 1 year.

We have a lot of dynamic content on the website that needs to be updated every 5 minutes or so (news and live market data). Does this means that everything will be cached for 1 day on the website? We are looking to cache only the images, css, js

Edit: I modified the .htaccess with this line but it didn't work Header set Cache-Control "max-age=3600, public"

I think nginx still working, as far I can see the header x-pagespeed that is set by nginx. If the working module of pagespeed is in apache server these header must be X-Mod-Pagespeed.

I'm confused. I have no idea what's going on. If I disable nginx in Plesk it doesn't work. image You would think the settings above would completely disable nginx but instead is seems that it disables apache and runs only on nginx! As soon as I disable the proxy mode, the htaccess stops working and the url rewriting returns 404 errors on all wordpress pages. So I am forced to keep the "proxy mode" option checked

According to Plesk documentation this is supposed to be the correct way to disable nginx and serve all files with Apache: https://docs.plesk.com/en-US/obsidian/customer-guide/72320/

I also tried via the CLI: plesk bin domain -u weedstreet420.com -nginx-serve-php false

Ah! your site is https, so you need to configure fechthttps or loadfromfile. By default, pagespeed tries to fecht resources by http, and maybe the 404 error´s you see is for don´t have the https enabled.

ModPagespeedFetchHttps enable

We tried enabling FetchHttps but the entire website will return an Internal Server Error as soon as it's enabled

Edit: nvm, the internal server error shows up only when FetchHttps is enabled in the htaccess. If I put FetchHttps in Plesk apache directive, there's no server error However, I am still stuck at the same place. The entire website is broken and all resources are 404 image image image

Images are returning a 404 error from Nginx even if it's supposed to be disabled. This is so confusing. image

ws420 commented 4 years ago

Update:

These changes seem to have helped. For the first time we see webp images!! GREAT! The debug mode is also fully working again

However, even if most of the images are converted to webp, we are still seeing 4xx errors for a lot of images image In this example, the images from the first post are successfully converted to webp but the images of the second post have 4xx errors

Thanks so much for your help

Lofesa commented 4 years ago

Hi I can´t see the webp images, but don´t have the infinite loop. I see the debug messages that say "<!--4xx status code, preventing rewriting of.." on each resource, so pagespeed is unabe to fecht the resources.... maybe the ssl config don´t work.

About nginx proxy... Have you stopped the service? I see it in the Plesk doc

Whats happens with cache-control header? Pagespeed need that resources have a public cacheable cache-control header, the max-age value is used as the ttl (time to live) in the pagespeed cache, so if you set it to 5 minutes, pagespeed make the resource outdated every 5 min in their cache, and all the optimization process for that resource, restart again.

When you say "We have a lot of dynamic content on the website that needs to be updated every 5 minutes or so...", you are talking about content, but for sure js , images or css files don´t change, so you can set their cache-control to 1 day or more time. The cache-control header say to the browser how much time the resource is valid in their cache, so the browser don´t need to download it again until it become outdated. When a resource become optimized by pagespeed, pagespeed changes their cache-control to 1 year.... What happens if the resource changes before this time? Well.. pagespeed set a hash in each optimized url, so if the resource changes, the hash change and you get a different url, that is cached for 1 year.

But for now... What I can see in your site: 1,- The server header still be nginx, so the nginx proxy is in place 2.- I see the x-mod-pagespeed header, so the pagespeed module is in the background apache server 3.- I see that the home page has 2 cache-control headers, 1 with 3600,public and 1 with nocache,must-revalidate, max-age=0 4.- All others resources in the home page has a valid cache-control header with 3600, public 5.- When in debug mode, all resources have these message "<!--4xx status code, preventing rewriting of.." so pagespeed is unable to fecht the resources and then can´t optimize it. Maybe you have set the FechtHttps directives in the wrong place or your server has the certificate directory in other place. 6.- I see you have a rewrite rule to change www.weedstreet420.com to weedstreet420.com , maybe you need to add an auth directive to cover all variants, some like:

ModPagespeedDomain http://.example.org

By default pagespeed only authorize the http version from where the resources are served. With this directive you are authorizing pagespeed to rewrite all versions of your site, http/https and all the subdomains (mainly www and non-www versions).

But my bet is that the ModPagespeedFetchHttps enable ModPagespeedSslCertDirectory directory ModPagespeedSslCertFile file are pointing to a bad directory/file.

What linux distro are you using? If a debian/ubuntu, can you test that /etc/ssl/certs exists han have files in it? or if a redhat/centos this directory /etc/pki/tls/certs exist and have a cert.pem file in it?

EDIT: As far as I can see, the images that are rewrited, like bg6.png or weedstreet420_logo.png, in the html code are relative url, images with and absolute url get the "<!--4xx status code,..." message. For me, this confirm that the problem is pagespeed can´t fecht resources over https.

ws420 commented 4 years ago

Strange, I didn't change anything since my last post, I went back to the website and now I don't see webp anymore. It was definitely working last time I checked

I contacted Plesk support to get help disabling Nginx. Here is what I was told:

By default port 80 is listened by nginx, so after applying this solution, the website will still be shown as processed by nginx in a web-browser. This is due to the fact that nginx is working as the front-end proxy for the whole server and it cannot be disabled for the specified domain. The website will be processed by Apache in fact. Here is an article describing it in details: https://support.plesk.com/hc/en-us/articles/360006364914-How-to-make-a-website-be-processed-only-by-Apache-when-nginx-is-enabled-on-the-server

Thanks for the details about the cache headers. I use ExpiresByType in the htaccess to set the cache header for each file type, is this the correct way to do it?

About nginx proxy... Have you stopped the service? I see it in the Plesk doc

Done, should be completely stopped now image

Maybe you have set the FechtHttps directives in the wrong place or your server has the certificate directory in other place.

FetchHttps is at the same place as the other pagespeed directives image

6.- I see you have a rewrite rule to change www.weedstreet420.com to weedstreet420.com , maybe you need to add an auth directive to cover all variants, some like:

Done, I added it to the directives, but I still get the 4xx error ModPagespeedDomain http://.weedstreet420.com

What linux distro are you using? If a debian/ubuntu, can you test that /etc/ssl/certs exists han have files in it? or if a redhat/centos this directory /etc/pki/tls/certs exist and have a cert.pem file in it?

CentOS 7.6.1810

image

There's no cert.pem file but I think cert.pem supposed to be a symlink to ca-bundle.crt ?

Just to make sure I understand: I am not supposed to copy the SSL certificate of my domain in this folder, right? "PageSpeed must be configured to point to a directory identifying trusted Certificate Authorities (not SSL keys for your domain)"

Lofesa commented 4 years ago

Now the nginx proxy is disabled, I can see server: Apache header and x-mod-pagespeed. All the resources have the "<!--4xx status code...", even those that are relative url. In my Centos 7.7 the /etc/pki/tls/certs/cert.pem is a symlink to /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem. Have you this file? This file is provided by ca-certificates-2019.2.32-76.el7_7.noarch package, maybe for 7.6 version is other. And yes, you not need to copy your certificates to these directories, and don´t use it as CA certificates. Think in pagespeed (for fecht purposes) as a browser. To fecht a SSL site, any browser need the root CA certificates chain that validates the certificate used by any site.

Maybe you have a rewrite rule in the htacces that changes url? When I use /?PageSpeedFilters=+debug in the home page, the + sign changes to a encoded space (%20) and the debug filter don´t work, I can see any debug message. But when used in other pages, the + sign stay here and the debug filter work.

But if we are unable to rigth configure the FechtHttps maybe can try other route to provide the files to pagespeed. The LoadFromFile path. This way need to set other set of directives. But firts try to configure FechtHttps with the rigth cert.pem file

ws420 commented 4 years ago

Yes, I can see the certificate in /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem

Maybe you have a rewrite rule in the htacces that changes url? When I use /?PageSpeedFilters=+debug in the home page, the + sign changes to a encoded space (%20) and the debug filter don´t work, I can see any debug message. But when used in other pages, the + sign stay here and the debug filter work.

It doesn't seem to be caused by the .htaccess, I tried to delete it and I was still having the issue you mentioned. I also tried to disable all Wordpress plugins, and removing all pagespeed directives beside "PageSpeed On" and I was still getting the %20

Lofesa commented 4 years ago

I´m getting the webp images again. Maybe is for the sort time in cache-control header. 3600 = 1h. This makes that every hour, the assets get not optimized and need some hist to get it again.

In the home page I still egtting the 2 cache-control headers.

Cache-Control: no-cache, must-revalidate, max-age=0
Cache-Control: max-age=3600, public, s-maxage=10

You nee to found where the no-cache... is added and supress it.

I forgot before comment on this: Yes you can use ExpiresByType for file types. But now, you have all resources with a cache-control= 3600, so maybe you have a header set in place and that averrides the ExpiresByType. If you use the config set in you comment add a

ExpiresByType text/html "some time you consider but make it cacheable"

ws420 commented 4 years ago

After hours of searching, I think we finally fixed the double cache-control headers. image

However, it broke the website again and all resources are returning 404 errors image

The errors in the debug mode are still 4xx. We had to disable PageSpeed temporarily because it broke the entire website.

I have also found a workaround to force the debug mode on the homepage. For some unknown reason it seems the plus sign (+) is being urlencoded to %20. This URL will trigger the debug mode on the homepage: https://www.weedstreet420.com/?PageSpeedFilters=%2Bdebug

The solution is to use the urlencoded version of the plus (+) character, which is %2B

Lofesa commented 4 years ago

Can you check if you have some like

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /404 [L,R=301]

in yours config files, mostly in htacces? If yes, then you need to add

RewriteCond %{REQUEST_URI} !pagespeed

ws420 commented 4 years ago

Yes, I have something similar in my htaccess. I added the new line but it doesn't seem to change anything, unless I did something wrong

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_URI} !pagespeed
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) wp/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
RewriteRule . index.php [L]

This URL still works fine for me: view-source:https://www.weedstreet420.com/?PageSpeedFilters=%2Bdebug

Lofesa commented 4 years ago

Well, are not the same rules I have posted. Can you change the rule with

RewriteCond %{REQUEST_URI} pagespeed [OR]

In other hand, I see here you changes some directory names to "wp", but in the html code I see other directories changed to "app" and I can´t se any rule for that in the write rules you have posted... Maybe have rewrite rules in others places?

P.D. the last line sound wrong the point (.) between index and php must be scaped RewriteRule . index.php [L] like in the 3rd line

ws420 commented 4 years ago

I didn't write the htaccess, it is the default htaccess from wordpress multisite here: https://wordpress.org/support/article/htaccess/ I'm pretty sure the htaccess is not causing the redirect issue ... I just tested again, even after deleting the htaccess file I still have the issue with %20

Previously you suggested to try LoadFromFiles so I just added this to the directives:

ModPagespeedLoadFromFile "https://www.weedstreet420.com/app/" \
"/var/www/vhosts/weedstreet420.com/httpdocs/web/app/"

ModPagespeedLoadFromFile "https://www.weedstreet420.com/wp/" \
"/var/www/vhosts/weedstreet420.com/httpdocs/web/wp/"

It seems to have solved the issue for now. I don't see 4xx errors anymore and no uncacheable error. The images are converted to .webp ... I hope it will still work in a couple of hours lol

Lofesa commented 4 years ago

Well... In the LoadfromFile path some others directives must be set. Why don´t simplyfy?

ModPagespeedLoadFromFile "https://www.weedstreet420.com/" \
"/var/www/vhosts/weedstreet420.com/httpdocs/web/" 

Some rules you can test:

ModPagespeedLoadFromFileRuleMatch Disallow .* # (this disallow all files) ModPagespeedLoadFromFileRuleMatch \.(js|css|jpg|jpeg|png|pdf|gif)$ (This allow any file with these extensions. You need to change to extensions files you use) The order of these directives make sense.

ModPagespeedLoadFromFileCacheTtlMs 604800000 When you load files from disk, these don´t have any http headers, with this directive, you set the ttl for a week (the time you put here is in miliseconds)... is like cache-control: 604800000.

Find the docs from these directives and set it to fit your need.

Now you can see some images still unoptimized, like organigram-holdings-inc-potstock-cannabis-investing.png. That is a spected behaviour. These files uses data-srcset and these label is not optimized. Take a look at the html code. You can see that srcset behind the nonscript tag are rewrited, or data-src, but not the data-srcset. In the pagespeed version you use, data-srcset are not optimized. A new version is next to public release (v1.14.36.1) with this version data-srcset is optimized too.

With LoadFromFile, each request run stat() to check the file, if the file changes, pagespeed reload it again.

Good luck.

EdinaWeb commented 2 years ago

Hey, did you solve the problem? I have the same problem too.