Author Topic: Leverage browser caching  (Read 7495 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Leverage browser caching
« on: May 13, 2018, 03:44:58 AM »
Hi
Before my VPS ran Apache Only, and I add blow codes in .htaccess, Google PageSpeed Insights said the "Leverage browser caching" working fine.
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">
<IfModule mod_expires.c>
AddType application/font-woff2 .woff2
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/webp A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType image/svg+xml A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/font-woff2 A2592000
</IfModule>
<IfModule mod_headers.c>
Header set Expires "max-age=2592000, public"
Header unset ETag
Header set Connection keep-alive
FileETag None
</IfModule>
</FilesMatch>
# END LBCWpFastestCache


Now I switch the server to Apache & Varnish Cache & Nginx Reverse Proxy, the previous codes has stopped work, so I search on google and add below codes, but PageSpeed Insights still said my website do not support "Leverage browser caching," how to do let my website support Leverage browser caching?

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 1 month"
</IfModule>

## EXPIRES CACHING ##
« Last Edit: May 13, 2018, 03:46:45 AM by gailclark80 »

Offline
*
Re: Leverage browser caching
« Reply #1 on: May 14, 2018, 03:44:52 AM »
 :)Still wait for response

Offline
*
Re: Leverage browser caching
« Reply #2 on: May 23, 2018, 04:57:44 PM »
Can you show the details of the pagespeed test for the leverage browser caching section? If it shows a time next to the resources listed there, then caching should be working.
Alternately, caching is set in the nginx vhost templates in the apache vhost template section of the admin panel. It says in the template to comment that out if you are using apache cache-control.