WebPagetest Forums
How to set Leverage browser caching - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Optimization Discussions (/forumdisplay.php?fid=5)
+--- Thread: How to set Leverage browser caching (/showthread.php?tid=14417)



How to set Leverage browser caching - picj86 - 07-27-2016 11:49 PM

Is anybody know how to set Leverage browser caching in .htaccess.

I have already below setting in my .htaccess but every time I am checking my page with pagespeed tools i am not getting expected results and seems image files are set for 5 days only.

##### Header Directives #####

<ifModule mod_headers.c>
Header unset ETag
Header unset Last-Modified
</ifModule>

# year
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$">
Header set Cache-Control "max-age=432000, public"
</FilesMatch>
#2 hours
<FilesMatch "\.(html|htm|xml|txt|xsl)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>
<FilesMatch "\.(js|css)$">
Header set Cache-Control "max-age=3600, public"
#SetOutputFilter DEFLATE
#Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
</FilesMatch>

Following are the results of my pagespeed test:
6e5fb8d27136e95/w/o/womens_clothing.jpeg (5 days)

You can view my site if you need to more investigation: http://www.shepkart.com

-- P J
http://www.shepkart.com


RE: How to set Leverage browser caching - pmeenan - 07-29-2016 10:19 PM

It looks like you are using CloudFlare. CloudFlare has it's own cache settings independent of what you configure on the server and you need to make any changes in their dashboard.


RE: How to set Leverage browser caching - picj86 - 08-01-2016 09:14 AM

Could you please let me know what are the settings needs to be done at CDN level?


RE: How to set Leverage browser caching - pmeenan - 08-01-2016 09:47 PM

You should check cloudflare's documentation or reach out to their support team. It is going to differ for every CDN.

Looks like this is a good place to start: https://support.cloudflare.com/hc/en-us/articles/202775670-How-Do-I-Tell-CloudFlare-What-to-Cache-