Home > Technical & Creative Skills > Programming, Servers & Scripts

How to "Leverage Browser Caching" (9)


03-06-2017 05:26 AM #1 jabong82 (Member)
How to "Leverage Browser Caching"

Sorry Im a newb when it comes to optimizing page speed etc.

When I run my landing pages through a pingdom speed check, I get an "F" grade for "Leverage Browser Caching".

It then shows me the following examples I need cached:

http://XXXX.cdn.beyondhosting.net/samples-1.gif
http://XXXX.cdn.beyondhosting.net/jq...in.js.download
http://XXXX.cdn.beyondhosting.net/showHide.js.download

These are sample files I have on my CDN (Beyond Hosting), so I shot them an email asking them if they could fix it. However the guy told me that I had to do it and they could not.

I have a dedicated server from them, and from reading online I saw that you add something to your .htaccess file.

So I added the below:

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


However I still show the browser caching error when I run my landing pages through various speed tests.

Is there a simple fix for this?

Sorry for the newb question, any help is appreciated!


03-06-2017 11:02 AM #2 caurmen (Administrator)

Don't worry about browser caching if you're running a standard affiliate campaign.

Browser caching is killer if people will be visiting your site more than once, because it reduces load times on a lot of assets to zero (or so close to zero as to make no difference).

But generally, we don't have people coming back for our campaign landers, so it's not an issue.

If you're running ecommerce or something where people may come back, that's more of a problem - is that the case?


03-06-2017 12:24 PM #3 jabong82 (Member)

Quote Originally Posted by caurmen View Post
Don't worry about browser caching if you're running a standard affiliate campaign.

Browser caching is killer if people will be visiting your site more than once, because it reduces load times on a lot of assets to zero (or so close to zero as to make no difference).

But generally, we don't have people coming back for our campaign landers, so it's not an issue.

If you're running ecommerce or something where people may come back, that's more of a problem - is that the case?
Thanks for the response Carumen

No Im running Adult mobile affiliate campaigns. Just wondering if that was going to mess with my page load times.


03-07-2017 12:26 PM #4 caurmen (Administrator)

Nope, you'll be absolutely fine.


03-07-2017 01:08 PM #5 diplomat (Member)

CDN items are usually cached by themselves. Seems like your CDN host is not sending caching headers which is kinda stupid. Your caching rules will apply only to your own static files that you serve from your domain. I'd suggest using Cloudfront instead of your current CDN host. Also browser caching is usually not important at all for lps because most of the times people will see your page once/twice so browser caching won't help really. Browser caching is only reasonable when people visit your page multiple times.


03-07-2017 01:38 PM #6 chris_climbs (Member)

Quote Originally Posted by diplomat View Post
CDN items are usually cached by themselves. Seems like your CDN host is not sending caching headers which is kinda stupid. Your caching rules will apply only to your own static files that you serve from your domain. I'd suggest using Cloudfront instead of your current CDN host. Also browser caching is usually not important at all for lps because most of the times people will see your page once/twice so browser caching won't help really. Browser caching is only reasonable when people visit your page multiple times.
I'm using CloudFront and when I run my landers through pingdom, I get the same grade & message for that section: "Leverage Browser Caching". Though the pages themselves still test fast.


03-07-2017 01:53 PM #7 diplomat (Member)

Quote Originally Posted by chris_climbs View Post
I'm using CloudFront and when I run my landers through pingdom, I get the same grade & message for that section: "Leverage Browser Caching". Though the pages themselves still test fast.
Read this: http://docs.aws.amazon.com/AmazonClo...onDownloadDist

For Cloudfront, your origin must specify "Cache-control" header. My bad for assuming it was done automatically, I just checked and I can see I have set it myself.


03-07-2017 10:08 PM #8 chris_climbs (Member)

Quote Originally Posted by diplomat View Post
Read this: http://docs.aws.amazon.com/AmazonClo...onDownloadDist

For Cloudfront, your origin must specify "Cache-control" header. My bad for assuming it was done automatically, I just checked and I can see I have set it myself.
Great to learn, thanks for the tip!!


03-09-2017 08:02 PM #9 roykoda (Member)

Thanks! I have exactly the same issue. I'll fix it now.

EDIT: still cannot fix it...


Home > Technical & Creative Skills > Programming, Servers & Scripts