Leverage browser caching

How to set max-age or expires for external links. See result of my client site. Thanks


anyone know how to fix it…Thanks

You cannot change that for external resources.

Hi can anyone know how to fix this, I had my latest result. How can I fix the Leverage browser caching of static assets.



My advice… change your focus and find out why a 4.5KB file like http://paramountinsurance.net/wp-content/uploads/2015/11/Insurance-Coverage-for-College-Students.jpg?c11df8 has a 2.5s TTFB.

Personally I’d throw away your solution to delivering remote files: if you can’t just copy and server them locally, I’d leave them alone, or if you’re really worried, decide whether you want to use the 3rdparty service that requires them.

Copy I will check thank you very much.

You’ll require setting caching headers at the Apache server level or requesting your Hosting Company do this (good luck). Is speed’s an issue, locate a hosting company who automatically sets all this up for all clients.

On Debian/Ubuntu do these steps…

  1. Create an expires.conf file. Rarely is a default expires.conf file provided. Here’s a copy off one of my servers.

net4-dev# cat /etc/apache2/mods-available/expires.conf

Header unset ETag
FileETag None

<FilesMatch “\.(js|css|jpg|png|gif|jpeg|mov|mp4|mp3|eof|woff)$”>
RequestHeader unset Cookie
Header unset Set-Cookie

  #<Files ~ "\.(html|htm|php|pl|cgi|txt)$">  
  # Header set Content-Type text/html
  # AddDefaultCharset UTF-8 

  ExpiresActive On
  ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresByType image/png "access plus 3 months"
  ExpiresByType image/jpg "access plus 3 months"
  ExpiresByType image/gif "access plus 3 months"
  ExpiresByType image/jpeg "access plus 3 months"
  ExpiresByType video/ogg "access plus 1 month"
  ExpiresByType video/mpeg "access plus 1 month"
  ExpiresByType video/mp4 "access plus 1 month"
  ExpiresByType video/quicktime "access plus 1 month"
  ExpiresByType video/x-ms-wmv "access plus 1 month"
  ExpiresByType text/css "access plus 3 months"
  ExpiresByType text/html "access plus 3 months"
  ExpiresByType text/javascript "access plus 3 months"
  ExpiresByType application/javascript "access plus 3 months"

  ExpiresByType image/svg+xml "access plus 3 months"
  ExpiresByType application/font-sfnt "access plus 3 months"
  ExpiresByType application/font-woff "access plus 3 months"
  ExpiresByType application/application/vnd.ms-fontobject "access plus 3 months"
  1. Enable the expires module + restart apache.

a2enmod expires
service apache2 restart

  1. Use curl to test headers…

curl -I -L www.marshallins.net | egrep ^Expires

Keep in mind your running WordPress on this site, so you’re probably far better off using something like ZenCache to correctly set all your headers.

Do not use W3TC, unless you’d like to spend hours mucking about with it, trying to get a minor performance increase.

<FilesMatch “\.(js|css|jpg|png|gif|jpeg|mov|mp4|mp3|eof|woff)$”>

remove the first \

I set expires headers for a few more…

Sorry for the difference in format, I primarily use nginx these days.