• Resolved rjrjrjrj

    (@rjrjrjrj)


    With the object cache enabled, I still get the following, from Ligthhouse:

    Serve static assets with an efficient cache policy 9 resources found
    A long cache lifetime can speed up repeat visits to your page. Learn more.
    WordPressRead about Browser Caching in WordPress.
    
    URL													Cache TTL 	Transfer Size
    …jquery/jquery.min.js?ver=3.6.0(www.domen.sfx)			None	88 KiB
    …07/cropped-Header2-1-768x179.png(www.domen.sfx)		None	79 KiB
    …webfonts/fa-solid-900.woff2(www.domen.sfx)				None	77 KiB
    …css/dashicons.min.css?ver=6.0(www.domen.sfx)			None	58 KiB
    …js/wp-emoji-release.min.js?ver=6.0(www.domen.sfx)		None	18 KiB
    …js/autoptimize_4ad5da9….js(www.domen.sfx)				None	17 KiB
    …js/lazysizes.min.js?ao_version=3.1.0(www.domen.sfx)	None	10 KiB
    …js/lazyload.min.js(www.domen.sfx)						None	6 KiB
    /analytics.js(www.google-analytics.com)					2 h		20 KiB
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    Thank you for reaching out and I am happy to assist you with this.
    The Object Caching does not set Browser Cache policy so this has nothing to do with the lighthouse report.
    Please make sure that the Browser Cache is enabled in Performance>General settings, and also make sure that the Cache-control header and Set expires-header are enabled in Performance>Browser Cache>CSS&JS section.
    Also, please share your website URL.
    THanks!

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    Browser cache was enabled. I checked off the headers you suggested but am still getting 200 in the dev tools from repeated reloading of the shop page with product images. Should they not be 301 or 304, cant remember which?

    I can see in the request headers “Cache-control:no-cache” and in the response header “cache-control:public” but I cannot see the “expires” header.

    Also enabled HTTP compression but Lighthouse still recommends it:

    Enable text compression
    3.03 s
    Text-based resources should be served with compression (gzip, deflate or brotli) to minimize total network bytes. Learn more.FCPLCP
    WordPressYou can enable text compression in your web server configuration.
    URL															Transfer Size	Potential Savings
    …jquery/jquery.min.js?ver=3.6.0(www.domain.sfx)		87.4 KiB		57.2 KiB
    …css/dashicons.min.css?ver=6.0(www.domain.sfx)		57.6 KiB		22.7 KiB
    …js/wp-emoji-release.min.js?ver=6.0(www.domain.sfx)	18.2 KiB		13.3 KiB
    …js/autoptimize_4ad5da9….js(www.domain.sfx)			16.4 KiB		10.8 KiB
    …js/lazysizes.min.js?ao_version=3.1.0(www.domain.sfx)9.6 KiB			5.6 KiB
    …js/lazyload.min.js(www.domain.sfx)					6.1 KiB			3.8 KiB

    I initially enabled deflate in Apache but got a WP note advising me against it and disabled it. What am I doing wrong?

    • This reply was modified 2 years, 7 months ago by rjrjrjrj.
    • This reply was modified 2 years, 7 months ago by rjrjrjrj.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    Thank you for your feedback.
    There is a chance that you have some custom Browser cache rules for expires header and cache control header in your .htaccess file or possibly in the httpd.conf.
    The default values in W3TC Browser Cache for static files regarding Expires header and cache control header is 31536000s, with Cache-Control policy: set to cache with max-age ("public, max-age=EXPIRES_SECONDS")
    As you shared, the Cache-control policy is set to no-cache
    This being said, please share your .htaccess content and check if you have any expires rules or cache control rules outside of W3TC rules for Browser Caching in your .htaccess file.
    And again, please share your website URL so I can check this.

    Thanks!

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    The site is not yet open to the outside.
    no-cache is not present in any configuration or .htaccess files. The main one is below:

    # BEGIN W3TC WEBP
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{HTTP_ACCEPT} image/webp
        RewriteCond %{REQUEST_FILENAME} (.+)\.(jpe?g|png|gif)$
        RewriteCond %1\.webp -f
        RewriteCond %{QUERY_STRING} !type=original
        RewriteRule (.+)\.(jpe?g|png|gif)$ $1.webp [NC,T=image/webp,E=webp,L]
    </IfModule>
    <IfModule mod_headers.c>
        <FilesMatch "\.(jpe?g|png|gif)$">
            Header append Vary Accept
        </FilesMatch>
    </IfModule>
    AddType image/webp .webp
    # END W3TC WEBP
    
    # BEGIN W3TC Browser Cache
    <IfModule mod_mime.c>
        AddType text/css .css
        AddType text/x-component .htc
        AddType application/x-javascript .js
        AddType application/javascript .js2
        AddType text/javascript .js3
        AddType text/x-js .js4
        AddType text/html .html .htm
        AddType text/richtext .rtf .rtx
        AddType text/plain .txt
        AddType text/xsd .xsd
        AddType text/xsl .xsl
        AddType text/xml .xml
        AddType video/asf .asf .asx .wax .wmv .wmx
        AddType video/avi .avi
        AddType image/avif .avif
        AddType image/avif-sequence .avifs
        AddType image/bmp .bmp
        AddType application/java .class
        AddType video/divx .divx
        AddType application/msword .doc .docx
        AddType application/vnd.ms-fontobject .eot
        AddType application/x-msdownload .exe
        AddType image/gif .gif
        AddType application/x-gzip .gz .gzip
        AddType image/x-icon .ico
        AddType image/jpeg .jpg .jpeg .jpe
        AddType image/webp .webp
        AddType application/json .json
        AddType application/vnd.ms-access .mdb
        AddType audio/midi .mid .midi
        AddType video/quicktime .mov .qt
        AddType audio/mpeg .mp3 .m4a
        AddType video/mp4 .mp4 .m4v
        AddType video/mpeg .mpeg .mpg .mpe
        AddType video/webm .webm
        AddType application/vnd.ms-project .mpp
        AddType application/x-font-otf .otf
        AddType application/vnd.ms-opentype ._otf
        AddType application/vnd.oasis.opendocument.database .odb
        AddType application/vnd.oasis.opendocument.chart .odc
        AddType application/vnd.oasis.opendocument.formula .odf
        AddType application/vnd.oasis.opendocument.graphics .odg
        AddType application/vnd.oasis.opendocument.presentation .odp
        AddType application/vnd.oasis.opendocument.spreadsheet .ods
        AddType application/vnd.oasis.opendocument.text .odt
        AddType audio/ogg .ogg
        AddType video/ogg .ogv
        AddType application/pdf .pdf
        AddType image/png .png
        AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
        AddType audio/x-realaudio .ra .ram
        AddType image/svg+xml .svg .svgz
        AddType application/x-shockwave-flash .swf
        AddType application/x-tar .tar
        AddType image/tiff .tif .tiff
        AddType application/x-font-ttf .ttf .ttc
        AddType application/vnd.ms-opentype ._ttf
        AddType audio/wav .wav
        AddType audio/wma .wma
        AddType application/vnd.ms-write .wri
        AddType application/font-woff .woff
        AddType application/font-woff2 .woff2
        AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
        AddType application/zip .zip
    </IfModule>
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType text/css A31536000
        ExpiresByType text/x-component A31536000
        ExpiresByType application/x-javascript A31536000
        ExpiresByType application/javascript A31536000
        ExpiresByType text/javascript A31536000
        ExpiresByType text/x-js A31536000
        ExpiresByType text/html A3600
        ExpiresByType text/richtext A3600
        ExpiresByType text/plain A3600
        ExpiresByType text/xsd A3600
        ExpiresByType text/xsl A3600
        ExpiresByType text/xml A3600
        ExpiresByType video/asf A31536000
        ExpiresByType video/avi A31536000
        ExpiresByType image/avif A31536000
        ExpiresByType image/avif-sequence A31536000
        ExpiresByType image/bmp A31536000
        ExpiresByType application/java A31536000
        ExpiresByType video/divx A31536000
        ExpiresByType application/msword A31536000
        ExpiresByType application/vnd.ms-fontobject A31536000
        ExpiresByType application/x-msdownload A31536000
        ExpiresByType image/gif A31536000
        ExpiresByType application/x-gzip A31536000
        ExpiresByType image/x-icon A31536000
        ExpiresByType image/jpeg A31536000
        ExpiresByType image/webp A31536000
        ExpiresByType application/json A31536000
        ExpiresByType application/vnd.ms-access A31536000
        ExpiresByType audio/midi A31536000
        ExpiresByType video/quicktime A31536000
        ExpiresByType audio/mpeg A31536000
        ExpiresByType video/mp4 A31536000
        ExpiresByType video/mpeg A31536000
        ExpiresByType video/webm A31536000
        ExpiresByType application/vnd.ms-project A31536000
        ExpiresByType application/x-font-otf A31536000
        ExpiresByType application/vnd.ms-opentype A31536000
        ExpiresByType application/vnd.oasis.opendocument.database A31536000
        ExpiresByType application/vnd.oasis.opendocument.chart A31536000
        ExpiresByType application/vnd.oasis.opendocument.formula A31536000
        ExpiresByType application/vnd.oasis.opendocument.graphics A31536000
        ExpiresByType application/vnd.oasis.opendocument.presentation A31536000
        ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000
        ExpiresByType application/vnd.oasis.opendocument.text A31536000
        ExpiresByType audio/ogg A31536000
        ExpiresByType video/ogg A31536000
        ExpiresByType application/pdf A31536000
        ExpiresByType image/png A31536000
        ExpiresByType application/vnd.ms-powerpoint A31536000
        ExpiresByType audio/x-realaudio A31536000
        ExpiresByType image/svg+xml A31536000
        ExpiresByType application/x-shockwave-flash A31536000
        ExpiresByType application/x-tar A31536000
        ExpiresByType image/tiff A31536000
        ExpiresByType application/x-font-ttf A31536000
        ExpiresByType application/vnd.ms-opentype A31536000
        ExpiresByType audio/wav A31536000
        ExpiresByType audio/wma A31536000
        ExpiresByType application/vnd.ms-write A31536000
        ExpiresByType application/font-woff A31536000
        ExpiresByType application/font-woff2 A31536000
        ExpiresByType application/vnd.ms-excel A31536000
        ExpiresByType application/zip A31536000
    </IfModule>
    <IfModule mod_deflate.c>
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon application/json application/vnd.ms-access video/webm application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.presentation application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf application/vnd.ms-opentype audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel
        <IfModule mod_mime.c>
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        </IfModule>
    </IfModule>
    <FilesMatch "\.(css|htc|less|js|js2|js3|js4|CSS|HTC|LESS|JS|JS2|JS3|JS4)$">
        FileETag MTime Size
        <IfModule mod_headers.c>
            Header set Pragma "public"
            Header append Cache-Control "public"
            Header unset Set-Cookie
        </IfModule>
    </FilesMatch>
    <FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|TXT|XSD|XSL|XML)$">
        FileETag MTime Size
        <IfModule mod_headers.c>
            Header set Pragma "public"
            Header append Cache-Control "public"
        </IfModule>
    </FilesMatch>
    <FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|avif|avifs|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|webp|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|webm|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|_ttf|wav|wma|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|AVIF|AVIFS|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|WEBP|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|WEBM|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|OGV|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|_TTF|WAV|WMA|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
        FileETag MTime Size
        <IfModule mod_headers.c>
            Header set Pragma "public"
            Header append Cache-Control "public"
            Header unset Set-Cookie
        </IfModule>
    </FilesMatch>
    <IfModule mod_headers.c>
        Header set Referrer-Policy "no-referrer-when-downgrade"
    </IfModule>
    # END W3TC Browser Cache
    # BEGIN W3TC Page Cache core
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteCond %{HTTPS} =on
        RewriteRule .* - [E=W3TC_SSL:_ssl]
        RewriteCond %{SERVER_PORT} =443
        RewriteRule .* - [E=W3TC_SSL:_ssl]
        RewriteCond %{HTTP:X-Forwarded-Proto} =https [NC]
        RewriteRule .* - [E=W3TC_SSL:_ssl]
        RewriteCond %{HTTP:Accept-Encoding} gzip
        RewriteRule .* - [E=W3TC_ENC:_gzip]
        RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]
        RewriteRule .* - [E=W3TC_PREVIEW:_preview]
        RewriteCond %{REQUEST_URI} \/$
        RewriteRule .* - [E=W3TC_SLASH:_slash]
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =""
        RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
        RewriteCond "%{DOCUMENT_ROOT}C:/htdocs/site/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SLASH}%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f
        RewriteRule .* "C:/htdocs/site/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SLASH}%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
    </IfModule>
    # END W3TC Page Cache core
    # 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
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    # BEGIN DS-XML-RPC-FIX-HOTLINK
    # The directives (lines) between "BEGIN DS-XML-RPC-FIX-HOTLINK" and "END DS-XML-RPC-FIX-HOTLINK" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    
    # END DS-XML-RPC-FIX-HOTLINK
    # BEGIN DS-XML-RPC-API
    # The directives (lines) between "BEGIN DS-XML-RPC-API" and "END DS-XML-RPC-API" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <Files xmlrpc.php>
    Require all denied
    
    </Files>
    
    # END DS-XML-RPC-API
    
    # Really Simple SSL
    Header always set Content-Security-Policy "upgrade-insecure-requests"
    Header always set X-XSS-Protection "0"
    Header always set X-Content-Type-Options "nosniff"
    Header always set Referrer-Policy "strict-origin-when-cross-origin" 
    Header always set X-Frame-Options: "SAMEORIGIN"
    Header always set Permissions-Policy: ""
    Header always set Strict-Transport-Security: "max-age=31536000" env=HTTPS 
    # End Really Simple SSL
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    Thank you for your feedback and for providing the .htaccess content.
    The W3TC part of the .htaccess looks as it should, so there are no problems here.
    The only thing that could be the problem in this case, is that you are either on Apache+Nginx and the nginx (proxy) is handling the rules for the static files, or the .htaccess file (possibly httpd.conf) in the upper lever of the website structure is overwriting the W3TC rules.

    I hope this helps!

    Thanks!

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    There is no Nginx.
    I am on Apache 2.4.54 with PHP 7.4.30.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    Thank you for the information.
    In this case, please check for any other .htaccess files in the upper level of your website’s structure or some server rules that are adding the no-cache cache-control.
    Thanks!

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    Yes, I ran a global search but found none. Nothing at all sets no-cache, on the server side.

    Now, could it be a FF thing? In Chromium the response is

    Status Code:200 (from disk cache)

    for images, stylesheets, and scripts and

    Status Code:200 (from memory cache)

    for fonts.

    If it is a browser issue, then what is causing it?

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    Caches must have had to be cleared. Now I stared seeing cache-control: public in FF as well.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Enabled object cache but Lighthouse still does not recognize it’ is closed to new replies.