New feature cache options for Incapsula CDN

→ Are you a new visitor? Please visit the page guidance for new visitors ←

Cache options for Incapsula CDN

I do write a few articles about website optimizations, how you can speed your website and run it faster, in most cases you can be ok using just normal browser cache, but some websites with lots of resources that needs downloaded at each visit its best to pass them through a CDN network. Doing so it will first reduce the load on your web server or for some of you on your shared hosting account, but at the same time, it will reduce the download time for your visitors. Since using a CDN will always use the closest server to them, this will get you a better user experience and will increase your website visits.

OK, back to us, I was saying that you can go by using normal browser cache, but using a CDN to cache everything I believe its better, however not all CDN’s offer great support and ease control over your cached objects. Incapsula CDN has introduced new cache options for every users to use, true that some may require upgrade but some important ones are still there and working.

What is new?

Completely new section for Performance containing the following cache options:

  • Ability to disable cache completely and also set aggressiveness (cool for static websites!)
  • Advanced caching rules
  • Content optimization
  • Advance settings

Caching mode

Incapsula has been nice enough to add now the option to aggressively cache content based on some specific rules made, for static content this is really great. You also have the option to change from:

  • Disable caching
  • Static only caching
  • Static+Dynamic
  • Aggressive caching

I remember before you only had the option to disable caching and wait for 5-10 minutes before you can enable it back again and this would then purge the cache.

The aggressive option however is welcomed, I’m currently using it for this site and working nicely. What I still see this as an issue is that they still don’t allow free users to purge specific resource from cache. I mean purging the entire cache would create more bandwidth usage for incapsula, meaning more bandwidth to pay for ISP providers or datacenter, but anyway, not my call here, just me rambling about. See below

how it looks now:

Caching mode

Caching mode

 

Advance caching rules

This option I believe is entirely new and only available for paid customers only, it allows you to create specific page caching, important for dynamic content where you don’t wish to cache them. Can’t give more details here as I’m not currently able to test them but here’s how the options look:

Advance cache rules

Advance cache rules

Content optimization

It includes resource validation for caching, minifying options like Javascript, CSS and HTML along with (upgrade options only) JPEG and PNG compression.

You also have two major options, meaning Compression on the fly and TCP Pre-pooling. Now why did I say two major ones? Compression is good but not always needed, some webserver compress their objects already by default so you can reduce overheads by disabling compression over an already compressed content.

The other one is TCP Pre-pooling, for those who do not know is similar to keep-alive connection in Webserver, but this by maintaining a few active connection for the time the session is active. See below how it looks:

Content Optimization

Content Optimization

Advance Settings

Lastly we have the advance settings that are there to let Incapsula know that we still want it to follow the no-cache and max-age headers:

  • Comply to no-cache and maxage headers
  • Comply to Vary: User-Agent

Meaning that if we want custom cache options with no-cache or max-age headers, we can set them on our web server using a .htaccess file and we can then set the cached options ourselves. For now I decided to use the aggressive options with a specific cached time. Should be working nicely 🙂

That’s it for today, will see you again next time with a new article.

  • ign_christian

    I’m having difficulties to setup browser caching with Incapsula. Tried several ways with htaccess, but Google Page Speed always returns “expiration not specified” for static contents. Also tried to set disable caching, static only, or aggressive within Incapsula but no difference.

    I saw you did proper setting with browser caching. Please advice what you did in your htaccess?

    • I leave mine to static only, default settings are more than good, and incapsula does uses the settings I set in .htaccess

      Header set Vary "Accept-Encoding, Cookie"
      Header set Cache-Control 'max-age=60, must-revalidate'

      is for this site currently, and if you look at the reponse from incapsula, you will see:

      • Also make sure you leave advance options there unchecked, those are tricky to handle, haven’t got used to them yet and can’t really advise …

        • ign_christian

          Hello..

          I’ve tried many ways with the htaccess, also your suggestion. But always generates same result (ex. for a png file):

          HTTP/1.1 200 OK
          Server:
          Date: Thu, 05 Dec 2013 04:07:33 GMT
          Content-Type: image/png
          Content-Length: 34286
          Last-Modified: Thu, 14 Nov 2013 06:15:48 GMT
          Connection: keep-alive
          Accept-Ranges: bytes
          X-Iinfo: 1-4963336-4963337 NNNN CT(94 -1 0) RT(1386216452454 0) q(0 0 1 -1) r(2 2) U6
          X-CDN: Incapsula

          So I think it’s on server side, but the web hoster didn’t provide useful information on that. Looks like mod_expires not activated.

          What do you think?

          • Well to control the cache you need mod_expires, to control the headers, you need mod_headers.

            Without them two, you can’t really make proper use of browser cache. Any well known hosters, if shown that headers you set are not showing (not through proxy as they’ll probably avoid helping you, complaining that its the proxy’s fault), they should understand the issue and help you accordingly. Its really simple to install both modules in apache.

          • ign_christian

            I’ve tried to explain that issue to hoster, but he just say sorry without any logic explanation about that.

            So I think to focus on another hoster, except I know the proper way to do that with php 🙂

          • Yes, its true you can set the headers using php, although I found that a bit wrong since php files normally shouldn’t be cached, those are dynamic files, if you have dynamic things in your website and trying to cache php files, you’ll expect things to go wrong there …

Request an article ←